perksukataus
07-23-2008, 03:57 AM
Hello.
I'm trying to get a message box to come up when my code errors out. I'd like it to say "No data to copy" or some such.
Here's the code - the * marks the error spot (i think)
Sheets("Current Month Paste").Select
range("A2").Select
range(Selection, Selection.End(xlToRight)).Select
range(Selection, Selection.End(xlToRight)).Select
range(Selection, Selection.End(xlToRight)).Select
range(Selection, Selection.End(xlToRight)).Select
Rows("2:2").Select
range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Transactions Since Inception").Select
Dim LastCell As range
With ActiveSheet
Set LastCell = .Cells(.Rows.Count, "A").End(xlUp)
If IsEmpty(LastCell) Then
'do nothing
Else
LastCell.Select
ActiveCell.Offset(1, 0).Select
* ActiveCell.PasteSpecial
range(Selection, Selection.End(xlDown)).Select
I'm trying to get a message box to come up when my code errors out. I'd like it to say "No data to copy" or some such.
Here's the code - the * marks the error spot (i think)
Sheets("Current Month Paste").Select
range("A2").Select
range(Selection, Selection.End(xlToRight)).Select
range(Selection, Selection.End(xlToRight)).Select
range(Selection, Selection.End(xlToRight)).Select
range(Selection, Selection.End(xlToRight)).Select
Rows("2:2").Select
range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Transactions Since Inception").Select
Dim LastCell As range
With ActiveSheet
Set LastCell = .Cells(.Rows.Count, "A").End(xlUp)
If IsEmpty(LastCell) Then
'do nothing
Else
LastCell.Select
ActiveCell.Offset(1, 0).Select
* ActiveCell.PasteSpecial
range(Selection, Selection.End(xlDown)).Select