Calling a worksheet using ThisWorkBook instead of Worksheets("Name")

qarbiq

New Member
Joined
Jan 4, 2014
Messages
20
Can someone please help me with the following issue that I have please ?</SPAN>

I am trying to change the way these comments out codes are made, changing the code to Thisworkbook style, ( I do not want to use the reference where it uses the name like “DATA” , etc. so here is what I wrote instead. but it’s not working , can someone tell me what I am doing wrong ? Is there any other better way to call a sheet except Thisworkbook and Worksheet ?</SPAN>


ThisWorkbook.Sheets(5).Active</SPAN>
ThisWorkbook.Sheets(1).Visible = xlVeryHidden</SPAN>
ThisWorkbook.Sheets(2).Visible = xlVeryHidden</SPAN>
ThisWorkbook.Sheets(3).Visible = xlVeryHidden</SPAN>
ThisWorkbook.Sheets(4).Visible = xlVeryHidden</SPAN>
ThisWorkbook.Sheets(5).Visible = xlSheetVisible</SPAN>

‘ ActiveWorkbook.Worksheets("RequestorStatus").Activate</SPAN>
'Worksheets("RequestorForm").Visible = xlVeryHidden</SPAN>
'Worksheets("Data").Visible = xlVeryHidden</SPAN>
'Worksheets("RequestorStatus").Visible = xlSheetVisible</SPAN>
'Worksheets("AssigneeForm").Visible = xlVeryHidden</SPAN>
'Worksheets("Main Page").Visible = xlVeryHidden</SPAN>
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
While in the VB Editor...In the properties window change the name of the sheet and use the name directly in your code.


RequestorForm.Visble = xlVeryHidden
Data.Visible = xlVeryHidden

etc.
 
Upvote 0

Forum statistics

Threads
1,203,487
Messages
6,055,713
Members
444,810
Latest member
ExcelMuch

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