I have a macro that opens another workbook, copies the data, and then pates the data into the bottom of the existing workbook. My problem is when the report I am copying from yields no records the macro errors on the paste command because it tries to copy the entire worksheet since there is no data to stop the Selection.End(xlDown).Select command. Is there a way I can tell the macro if Cell A2 is blank to skip to another step?
----------------------This is where I copy the data
Range("A2").Select
ActiveCell.Name = "Begin"
Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(0, 13).Select
ActiveCell.Name = "End"
Range("Begin:End").Select
Selection.Copy
---------------------This is where I go to the other workbook and find the end of the existing data.
ActiveWindow.ActivateNext
Range("A1").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveCell.Name = "Begin"
ActiveCell.Offset(0, 13).Select
ActiveCell.Name = "End"
Range("Begin:End").Select
-------------------------This is where I try to paste the data from the first workbook to the bottom the of data on the second workbook. This is where I get the error if there was no data on the first workbook.
Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Bookmarks