I'd appreciate some help on probably a simple problem.
I want to clear the contents on Sheet1 of a range from row 15 to 51 but the column number is a variable based on a Input box (Dim myValue As Integer).
When I run the VBA from the Sheet1 it works fine as follows
But, I need to run it from another sheet.
This doesn't work. What an I doing wrong?
I want to clear the contents on Sheet1 of a range from row 15 to 51 but the column number is a variable based on a Input box (Dim myValue As Integer).
When I run the VBA from the Sheet1 it works fine as follows
Code:
ActiveSheet.Range(Cells(15, (myValue)), Cells(51, (myValue))).ClearContents
But, I need to run it from another sheet.
Code:
Worksheets("Sheet1").Range(Cells(15, (myValue)), Cells(51, (myValue))).ClearContents
This doesn't work. What an I doing wrong?