Can someone please explain to me what I did wrong/ what is missing here. I need this code to do a couple things. First search for a worksheet using variable 'Page' which is a cell on sheet1. Each Sheet is named 1-80 and the cell it references may be any one of those numbers.
Next I need it to search in a certain range for another variable. That variable, Sun, can also be found on sheet 1.
I was able to write (Sheets(Page).Select) and it would work. And (ActiveSheet.Range("A1:B5").Find(What:=Sun).Offset(0, 1).Select) would also work.
Why do they not work when combined?
Thanks guys
Next I need it to search in a certain range for another variable. That variable, Sun, can also be found on sheet 1.
I was able to write (Sheets(Page).Select) and it would work. And (ActiveSheet.Range("A1:B5").Find(What:=Sun).Offset(0, 1).Select) would also work.
Why do they not work when combined?
Thanks guys
VBA Code:
Dim Page As String
Page = Sheet1.Range("A4")
Dim Sun As String
Sun = Sheet1.Range("B1")
Sheets(Page).Range("A1:B5").Find(What:=Sun).Offset(0, 1).Select