macros and hidden sheets

mani_singh

Well-known Member
Joined
Jul 24, 2007
Messages
583
ive got a macro which works with data on hidden sheets within the workbook - when i hide the sheets the macro gives errors and will not run. when i unhide the sheets everything runs fine!

any ideas how i can hide them and have the macro run ? :(
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Hi,

You are probably using code with expressions like "select", "selection", "activate", "activecell"... Can you post some lines which are not working. Someone will be able to help you to edit the code.

kind regards,
Erik
 
Upvote 0
you guys are right i am using the "select" command, but what do i need to use?


Sheets("running").Select

Application.ScreenUpdating = False
Sheets("Baseline Data").Select
Range("H2:H1500").Select
Selection.Copy
Sheets("Hidden").Select
Range("A2").Select
ActiveSheet.Paste
 
Upvote 0
you guys are right i am using the "select" command, but what do i need to use?


Sheets("running").Select

Application.ScreenUpdating = False
Sheets("Baseline Data").Select
Range("H2:H1500").Select
Selection.Copy
Sheets("Hidden").Select
Range("A2").Select
ActiveSheet.Paste
 
Upvote 0
you guys are right i am using the "select" command, but what do i need to use?


Sheets("running").Select

Application.ScreenUpdating = False
Sheets("Baseline Data").Select
Range("H2:H1500").Select
Selection.Copy
Sheets("Hidden").Select
Range("A2").Select
ActiveSheet.Paste
 
Upvote 0
Well, instead of that particular code you could use:

Code:
Application.ScreenUpdating = False
Sheets("Baseline Data").Range("H2:H1500").Copy _
Destination:=Sheets("Hidden").Range("A2")
 
Upvote 0
so what about if im selecting a hidden sheet? what am i looking for? i.e. the first line of my code snipet
 
Upvote 0
Sheets("running").Select

That wasn't doing anything (other than selecting it) so i simply removed it. You rarely need to select anything to work with it (as the range copy in the code I provided shows). Post what you are actuallly doing with any hidden sheets and we can suggest changes/improvements.
 
Upvote 0
you only need to "select" when you really want to "GO TO" a sheet
example: you click a button and want to end up on certain sheet, (and certain range)

to "operate" you do not need to select
Richard already provided some code to copy
here a very simple example to put a value in a cell
Sheets("running").Range("A1") = 1
 
Upvote 0

Forum statistics

Threads
1,214,569
Messages
6,120,286
Members
448,953
Latest member
Dutchie_1

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