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.
Bookmarks