basic unhide sheet text&B1

Peterfc2

Active Member
Joined
Jan 2, 2004
Messages
394
Office Version
  1. 2013
Platform
  1. Windows
I have two sheets I want to unhide.

Worksheets("FIXTURES 1990-91").Visible = True
Worksheets("STATS 1990-91").Visible = True

This works ok, but I need to say

Worksheets("FIXTURES & B1").Visible = True
Worksheets("STATS & B1").Visible = True
Where cell B1 holds 1990-91.

This doesn't work. My brains gone to sleep. Help Please!
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Tetra201

MrExcel MVP
Joined
Oct 14, 2016
Messages
3,832
Try using

Worksheets("FIXTURES " & B1).Visible = True
Worksheets("STATS " & B1).Visible = True
 
Upvote 0

CsJHUN

Active Member
Joined
Jan 13, 2015
Messages
360
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
  2. Mobile
Hi!

How about this:
Code:
Worksheets("FIXTURES " & Sheets("where b1 contain 1990-91").Range("B1").value).Visible = True
Worksheets("STATS " & Sheets("where b1 contain 1990-91").Range("B1").value).Visible = True
There is a " " (space) after the fixtures and stats, then calling the value of "B1" the Sheets("where b1 contain 1990-91")
 
Upvote 0

Peterfc2

Active Member
Joined
Jan 2, 2004
Messages
394
Office Version
  1. 2013
Platform
  1. Windows
Not working
Worksheets("FIXTURES " & B1).Visible = True
Worksheets("STATS " & B1).Visible = True
 
Upvote 0

Tetra201

MrExcel MVP
Joined
Oct 14, 2016
Messages
3,832
ADVERTISEMENT
Oops. Of course it should read:

Worksheets("FIXTURES " & Range("B1").Value).Visible = True
Worksheets("STATS " & Range("B1").Value).Visible = True
 
Upvote 0

Peterfc2

Active Member
Joined
Jan 2, 2004
Messages
394
Office Version
  1. 2013
Platform
  1. Windows
YES, THATS GOT IT!
However moving on I get an error if that sheet name is non existent. Anyone know a way of trapping it.
 
Upvote 0

Tetra201

MrExcel MVP
Joined
Oct 14, 2016
Messages
3,832
ADVERTISEMENT
Not sure what you want to do, but here is the code:
Code:
On Error Resume Next
Worksheets("FIXTURES " & Range("B1").Value).Visible = True
On Error Resume Next
Worksheets("STATS " & Range("B1").Value).Visible = True
On Error GoTo 0
 
Upvote 0

Forum statistics

Threads
1,195,617
Messages
6,010,728
Members
441,565
Latest member
menangterus556

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
Top