X
xrull
I've got a problem. The tabname of the sheet keeps changing (or people
keep changing it) and I've got to keep changing the VBA code.
Is it possible for the VBA code to pick up the tab name in the code
instead of the direct reference?
I used this code:
Run_Me_Now()
Sheets("ABC").Select
Columns("A:I").Select
Selection.ClearContents
Sheets("XYZ").Select
Columns("A:I").Select
Selection.Copy
Sheets("ABC").Select
Range("A1").Select
ActiveSheet.Paste
End Sub
But when I changed it to this code:
Worksheets(2).Select
Columns("A:I").Select
Selection.ClearContents
Worksheets(1).Range("A:I").Select
Columns("A:I").Select
Selection.Copy
Worksheets(2).Select
Range("A1").Select
ActiveSheet.Paste
End Sub
It fails.
I've searched the forum, but I'm unable to find an answer.
Please help
Joni
keep changing it) and I've got to keep changing the VBA code.
Is it possible for the VBA code to pick up the tab name in the code
instead of the direct reference?
I used this code:
Run_Me_Now()
Sheets("ABC").Select
Columns("A:I").Select
Selection.ClearContents
Sheets("XYZ").Select
Columns("A:I").Select
Selection.Copy
Sheets("ABC").Select
Range("A1").Select
ActiveSheet.Paste
End Sub
But when I changed it to this code:
Worksheets(2).Select
Columns("A:I").Select
Selection.ClearContents
Worksheets(1).Range("A:I").Select
Columns("A:I").Select
Selection.Copy
Worksheets(2).Select
Range("A1").Select
ActiveSheet.Paste
End Sub
It fails.
I've searched the forum, but I'm unable to find an answer.
Please help
Joni