Hello!
I have an existing macro that copies a range of data to another worksheet. I have an error code to determine if the destination worksheet exists.
I also want to make sure that the destination range is empty before I copy to it. If the range is not empty I want to display a message box stating this fact and exit the macro.
Note: cell P13 contains a number that determines which worksheet to copy the range to. For example: if P13=2 the range is copied to worksheet "Week2" - Range ("A5").
This is my existing macro:
Thanks for your help!
Sub Copy()
'
On Error GoTo ErrorTrap1
Sheets("ThisWeek").Range("B15:C46").Copy Sheets("Week" & Sheets("ThisWeek").Range("P13")).Range("A5")
Range("B7").Select
Exit Sub
ErrorTrap1:
MsgBox "Check cell P13 - Could not find worksheet Week#_"
End Sub
Bookmarks