I'm using VBA in excel and I ran into a problem
I have the name of a worksheet in a variable and what I want to do is activate that worksheet using the variable.
Does anyone have any ideas?
Printable View
I'm using VBA in excel and I ran into a problem
I have the name of a worksheet in a variable and what I want to do is activate that worksheet using the variable.
Does anyone have any ideas?
sheetname = "Sheet3"
Sheets(sheetname).Select
just tried this...should work fine
Code:Private Sub CommandButton1_Click()
x = "Sheet2"
Sheets(x).Select
End Sub
Thanks. it works!