Results 1 to 11 of 11

Code for coping a whole row from one sheet to another

Threaded View

  1. #1
    Registered User
    Join Date
    08-17-2013
    Location
    chicago
    MS-Off Ver
    Excel 2003
    Posts
    27

    Exclamation Code for coping a whole row from one sheet to another

    Hi I have a code:
    Private Sub CommandButton18_Click()
    
        Dim src As Worksheet
        Dim tgt As Worksheet
        Dim filterRange As Range
        Dim copyRange As Range
        Dim lastRow As Long
    
        Set src = ThisWorkbook.Sheets("TOTALS")
        Set tgt = ThisWorkbook.Sheets("CUSTOM MAX REPORT ")
    
        ' turn off any autofilters that are already set
        src.AutoFilterMode = False
    
        ' find the last row with data in column I
        lastRow = src.Range("I" & src.Rows.Count).End(xlUp).Row
       
    
    
        ' the range that we are auto-filtering (all columns)
        Set filterRange = src.Range("I3:I" & 152)
     
    
    
        ' the range we want to copy (only columns we want to copy)
        ' in this case we are copying country from column A
        ' we set the range to start in row 2 to prevent copying the header
        Set copyRange = src.Range("I3:I" & 152)
    It copies a cell from sheet 1 into a cell in sheet 2, however I need it to copy the whole row (and place it into the appropriate columns (the columns match the first sheet)). What should I change?

    Thank you for your help

    Moderators note: code tags added for you - this time
    Last edited by sunshne900; 09-22-2013 at 12:59 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Two question, numeric code question and subtraction of two columns?
    By mgsweden78 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-18-2008, 02:50 AM
  2. VBA Code Question
    By JasonHerndon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-10-2007, 05:59 PM
  3. [SOLVED] code question
    By Ana in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-02-2006, 05:55 AM
  4. Code Question
    By Ronbo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-23-2005, 05:05 PM
  5. code question
    By Gary Keramidas in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 07-19-2005, 01:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1