VBA error on a hidden sheet

e.cichlid

New Member
Joined
Jun 27, 2008
Messages
33
Hello,

I've done a search here and could not find the same situation as me.

I have a pull-down menu on worksheet_2 that has a macro assigned. The macro looks on worksheet_1 for the data and plots a graph on worksheet_2. If I hide worksheet_1 the macro stops at a marker directing to look on worksheet_1.

Is there a work around for this?

Thanks.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Can you post the code. You can't select a hidden sheet but you can read data from it.
 
Upvote 0
Below is the code.

Sub Macro1()
'
' Macro1 Macro
'
'
Select Case Range("A1").Value
Case 1

Sheets("Worksheet").Select
Range("BT3:CD3").Select
Selection.Copy
Sheets("Sheet1").Select
Range("C1").Select
ActiveSheet.Paste

Case 2

Sheets("Worksheet").Select
Range("BT4:CD4").Select
Selection.Copy
Sheets("Sheet1").Select
Range("C1").Select
ActiveSheet.Paste

etc.... 40 cases

End Select
End Sub
 
Upvote 0
Try this for Case 1

Code:
Case 1

Sheets("Worksheet").Range("BT3:CD3").Copy Destination:=Sheets("Sheet1").Range("C1")

Case 2
 
Upvote 0

Forum statistics

Threads
1,214,648
Messages
6,120,725
Members
448,987
Latest member
marion_davis

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