Selecting a worksheet based on a cell value in Excel VBA


This Content is from Stack Overflow. Question asked by Tom

I am trying to select a particular page based on cell value U2. I am using the backend Excel names not the display names for the sheets. “Sheet11” is the sheet I am currently trying to connect to. I have tried the following codes, but getting run-time error 9, out of range.

What could I try next?


‘Dim ws As Worksheet
‘ws = Range(“U2”)
‘Set ws = ActiveSheet


‘Works but no variable



‘Dim GetString As String
‘GetString = Range(“U2”)


Check the Answers

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?