Results 1 to 7 of 7

Set copy range from "A2" down to first completely empty row?

Threaded View

klunker Set copy range from "A2" down... 03-31-2014, 04:45 PM
protonLeah Re: Set copy range from "A2"... 03-31-2014, 05:11 PM
klunker Re: Set copy range from "A2"... 03-31-2014, 06:21 PM
protonLeah Re: Set copy range from "A2"... 03-31-2014, 07:10 PM
klunker Re: Set copy range from "A2"... 04-01-2014, 02:10 PM
protonLeah Re: Set copy range from "A2"... 04-01-2014, 09:58 PM
klunker Re: Set copy range from "A2"... 04-02-2014, 08:42 AM
  1. #1
    Registered User
    Join Date
    11-25-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    61

    Set copy range from "A2" down to first completely empty row?

    Hi All,
    I have the following code I found on the web and am having a difficult time setting my copy range from "A2:first completely empty row". I've put starts next to the bit of code that calls out the copy range that I think needs to be changed. Any help would be greatly appreciated.


    Private Sub CommandButton1_Click()
    '
    Dim wbThisBook          As Workbook 'workbook where the data is to be pasted
    Dim wbTargetBook        As Workbook 'workbook from where the data is to copied
    
    FilePath4 = Sheets("Hidden Data").Range("N4") 'name of workbook to open
       
     Set wbThisBook = ActiveWorkbook
    
     ' clear contents currently in cells
     wbThisBook.Worksheets("App B").Range("A1:V50").Clear
     
      'activate the source book
     Set wbTargetBook = Workbooks.Open(FilePath4)
     wbTargetBook.Activate
    
       'clear anything on clipboard to maximize available memory
     Application.CutCopyMode = False
    
         'Copy select data from target book
     wbTargetBook.Sheets("Array 8").Range("A2:V50").Copy '**********************
       
     wbThisBook.Activate
       
       'paste the data in this book
     wbThisBook.Sheets("App B").Range("A2").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
     wbThisBook.Sheets("App B").Range("A2").PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
    
       'clear anything on clipboard to maximize available memory
    Application.CutCopyMode = False
    
       'save the target book
     wbTargetBook.Save
    
       'close the workbook
    wbTargetBook.Close
    
       'activate the source book again
     wbThisBook.Activate
    
        'go back to main input sheet
    Sheets("Data Input").Activate
    
       'clear memory
     Set wbTargetBook = Nothing
     Set wbThisBook = Nothing
    
    End Sub
    Thank you.
    Last edited by JBeaucaire; 03-31-2014 at 04:47 PM. Reason: Corrected [/code] tag

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How to copy into next empty row using "for each cell in range" loop
    By GIS2013 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-23-2013, 02:30 PM
  2. Replies: 3
    Last Post: 06-04-2011, 10:56 AM
  3. Why does =countif(range,"<>""") count empty cells?
    By Ingeniero1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-16-2008, 01:40 PM
  4. Replies: 4
    Last Post: 02-03-2008, 05:11 PM
  5. "" not completely blanc if copy
    By Esrei in forum Excel General
    Replies: 3
    Last Post: 06-13-2006, 08:20 AM

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