J
J.W. Aldridge
I run three consecutive codes named consolidate 1, 2, then 3.
Using the example below, I get an error if the copy range has no
data.
What is the best way to rewrite this or somehow avoid the error if
there is no data.
I want it to simply move on to the next step if there's nothing to
copy and or paste.
Sub Consolidate1()
Sheets("apples").Select
Range("a2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("Summary").Select
Range("A65536").End(xlUp).Select
ActiveCell.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Application.Goto Selection.Cells(1)
End Sub
Using the example below, I get an error if the copy range has no
data.
What is the best way to rewrite this or somehow avoid the error if
there is no data.
I want it to simply move on to the next step if there's nothing to
copy and or paste.
Sub Consolidate1()
Sheets("apples").Select
Range("a2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("Summary").Select
Range("A65536").End(xlUp).Select
ActiveCell.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone,
SkipBlanks:= _
False, Transpose:=False
Application.Goto Selection.Cells(1)
End Sub