View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
J.W. Aldridge J.W. Aldridge is offline
external usenet poster
 
Posts: 425
Default Avoid paste error if nothing was copied.

Sub Consolidate1()

Application.ScreenUpdating = False

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

_______________________________
Sub Consolidate2()

Application.ScreenUpdating = False

Sheets("cherries").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
____________________________
Sub Consolidate3()

Application.ScreenUpdating = False

Sheets("grapes").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