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

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
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
 

mani_singh

Well-known Member
Joined
Jul 24, 2007
Messages
583
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
 

mani_singh

Well-known Member
Joined
Jul 24, 2007
Messages
583
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
 

mani_singh

Well-known Member
Joined
Jul 24, 2007
Messages
583
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
 

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
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")
 

mani_singh

Well-known Member
Joined
Jul 24, 2007
Messages
583
so what about if im selecting a hidden sheet? what am i looking for? i.e. the first line of my code snipet
 

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
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.
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
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
 

Forum statistics

Threads
1,181,648
Messages
5,931,212
Members
436,784
Latest member
amuljono

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