Worksheet with variable name

morrisgr

Board Regular
Joined
Dec 17, 2005
Messages
62
Hi.
I don't think my query will cause any of you guys much difficulty.
I want to activate a sheet named "Num-4".

I've tried many variations........unsuccessfully.
What am I doing wrong??
Thanks for any assistance you can provide
Morris

Sub ChooseSheet()

' I want to activate Sheet Num-4. The variable Num-4 is Formatted as Text in the same Workbook.

Dim actcell As String

Range("E4").Select 'This cell contains "Num-4"

actcell = ActiveCell


Worksheets(actcell).Activate


End Sub
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
What error do you get with that code?
 
Upvote 0
In that case you don't have a worksheet with the same name as the value in E4.
 
Upvote 0
Hi.
Attached are 2 screenshots, one showing the sheets and another where I created the sheet names from.
The second image used "=CONCATENATE(A4,B4) " and then, I thought the format might be causing the problem, so I 'Copied and Pasted Special......"Value" into column E
Hope that helps.
 

Attachments

  • ExcelFile1.jpg
    ExcelFile1.jpg
    158.1 KB · Views: 7
  • ExcelFile2.jpg
    ExcelFile2.jpg
    72.4 KB · Views: 7
Upvote 0
OUCH!!!!
Couldn't see the wood for the trees.
Sorry to have wasted your time............it's very hot here in Spain.
Many thanks
Morris
 
Upvote 0

Forum statistics

Threads
1,214,622
Messages
6,120,580
Members
448,972
Latest member
Shantanu2024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top