I am trying to change worksheet during run-time so I wrote this code in VBA:
Dim Item As Variant
Dim Info As Variant
Dim Stat As Integer
Stat = 2
Dim Line As Integer
Line = 1
Item = "Cases"
Sheets(Item).Activate
Do
Line = Line + 1
Loop While Cells(Line, "B") <> Null
Do
Info = Cells(1, Stat)
Info = InputBox("what is the item " & Info & "?")
Cells(Line, Stat) = Info
Loop While Cells(1, Stat) <> Null
the activate function does open the worksheet named "Cases" just like I wanted, but when this part runs "Info = Cells(1, Stat)" it still takes the information from the last worksheet even though I see the "Cases" worksheet.
I looked in another vba code I wrote which I used the same method, it worked there but I couldn't find anything different I did there that could make it work there and was missing here.