Macro and hidden sheets

Hi,

I have a WB with 10 worksheets.
At the time I did this WB,  I also created a Macro that had the task to 
change the format of all the sheets.
Today, I have decided to hide some of the sheets and the macro does no 
longer work.
I guess this is because it cannot find the sheets which are hidden.

My question is: Is there a way to allow the Macro to work as before, meaning 
to continue changing the format of the hidden sheets as well?
Something like a condition that says, if Sheet XY is hidden then look for it 
into etc.

Thank you
Alex

0
Metallo (10)
1/18/2006 12:51:06 PM
excel.misc 78881 articles. 5 followers. Follow

7 Replies
893 Views

Similar Articles

[PageSpeed] 34

Hi Alex,

A hidden sheet cannot be selected, so try re-writing your code to remove 
selections.

If this does nor resolve your problem, post your code.


---
Regards,
Norman


"Metallo" <Metallo@discussions.microsoft.com> wrote in message 
news:AE72C4F3-4EE6-47DD-B83C-AD8AF2A15A7D@microsoft.com...
> Hi,
>
> I have a WB with 10 worksheets.
> At the time I did this WB,  I also created a Macro that had the task to
> change the format of all the sheets.
> Today, I have decided to hide some of the sheets and the macro does no
> longer work.
> I guess this is because it cannot find the sheets which are hidden.
>
> My question is: Is there a way to allow the Macro to work as before, 
> meaning
> to continue changing the format of the hidden sheets as well?
> Something like a condition that says, if Sheet XY is hidden then look for 
> it
> into etc.
>
> Thank you
> Alex
> 


0
normanjones (1047)
1/18/2006 12:58:35 PM
Norman,

I am aware that it cannot be selected, but my question was another, that is, 
is there a workaround to make the hidden sheets selectable even if they are 
hidden?

For instance, the formulas work fine, the values generated as a result of a 
calculation turn out in the hidden sheets as if the they were unhidden, 
therefore I was wondering: If the formulas work on hidden sheets, why cannot 
the macros?

Hope this is clearer.

Thank you!
Alex

"Norman Jones" wrote:

> Hi Alex,
> 
> A hidden sheet cannot be selected, so try re-writing your code to remove 
> selections.
> 
> If this does nor resolve your problem, post your code.
> 
> 
> ---
> Regards,
> Norman
> 
> 
> "Metallo" <Metallo@discussions.microsoft.com> wrote in message 
> news:AE72C4F3-4EE6-47DD-B83C-AD8AF2A15A7D@microsoft.com...
> > Hi,
> >
> > I have a WB with 10 worksheets.
> > At the time I did this WB,  I also created a Macro that had the task to
> > change the format of all the sheets.
> > Today, I have decided to hide some of the sheets and the macro does no
> > longer work.
> > I guess this is because it cannot find the sheets which are hidden.
> >
> > My question is: Is there a way to allow the Macro to work as before, 
> > meaning
> > to continue changing the format of the hidden sheets as well?
> > Something like a condition that says, if Sheet XY is hidden then look for 
> > it
> > into etc.
> >
> > Thank you
> > Alex
> > 
> 
> 
> 
0
Metallo (10)
1/18/2006 1:13:03 PM
You can reach your end goal by altering your Macro to first check each sheet 
to see if it is Hidden, and if so then unhide it > perform your reformatting 
> and then rehide it and go on to the next.......if the sheet is not hidden, 
then just perform the reformatting and go on.....

Vaya con Dios,
Chuck, CABGx3



"Metallo" wrote:

> Hi,
> 
> I have a WB with 10 worksheets.
> At the time I did this WB,  I also created a Macro that had the task to 
> change the format of all the sheets.
> Today, I have decided to hide some of the sheets and the macro does no 
> longer work.
> I guess this is because it cannot find the sheets which are hidden.
> 
> My question is: Is there a way to allow the Macro to work as before, meaning 
> to continue changing the format of the hidden sheets as well?
> Something like a condition that says, if Sheet XY is hidden then look for it 
> into etc.
> 
> Thank you
> Alex
> 
0
CLR (806)
1/18/2006 1:32:04 PM
Hi Alex.

Post the problematic code.


---
Regards,
Norman



"Metallo" <Metallo@discussions.microsoft.com> wrote in message 
news:146507EB-FB5B-42EE-8E7C-B0A9AE032E9F@microsoft.com...
> Norman,
>
> I am aware that it cannot be selected, but my question was another, that 
> is,
> is there a workaround to make the hidden sheets selectable even if they 
> are
> hidden?
>
> For instance, the formulas work fine, the values generated as a result of 
> a
> calculation turn out in the hidden sheets as if the they were unhidden,
> therefore I was wondering: If the formulas work on hidden sheets, why 
> cannot
> the macros?
>
> Hope this is clearer.
>
> Thank you!
> Alex
>
> "Norman Jones" wrote:
>
>> Hi Alex,
>>
>> A hidden sheet cannot be selected, so try re-writing your code to remove
>> selections.
>>
>> If this does nor resolve your problem, post your code.
>>
>>
>> ---
>> Regards,
>> Norman
>>
>>
>> "Metallo" <Metallo@discussions.microsoft.com> wrote in message
>> news:AE72C4F3-4EE6-47DD-B83C-AD8AF2A15A7D@microsoft.com...
>> > Hi,
>> >
>> > I have a WB with 10 worksheets.
>> > At the time I did this WB,  I also created a Macro that had the task to
>> > change the format of all the sheets.
>> > Today, I have decided to hide some of the sheets and the macro does no
>> > longer work.
>> > I guess this is because it cannot find the sheets which are hidden.
>> >
>> > My question is: Is there a way to allow the Macro to work as before,
>> > meaning
>> > to continue changing the format of the hidden sheets as well?
>> > Something like a condition that says, if Sheet XY is hidden then look 
>> > for
>> > it
>> > into etc.
>> >
>> > Thank you
>> > Alex
>> >
>>
>>
>> 


0
normanjones (1047)
1/18/2006 1:32:10 PM
Chuck,

Easy to say, but I have no clou on how to instruct the macro to check if the 
sheet is hidden or not.
Can you give me a sample so that I understand how it works and then I can 
apply it to my macro?

Thanks man

Vai con Dio, indeed!
Alex

"CLR" wrote:

> You can reach your end goal by altering your Macro to first check each sheet 
> to see if it is Hidden, and if so then unhide it > perform your reformatting 
> > and then rehide it and go on to the next.......if the sheet is not hidden, 
> then just perform the reformatting and go on.....
> 
> Vaya con Dios,
> Chuck, CABGx3
> 
> 
> 
> "Metallo" wrote:
> 
> > Hi,
> > 
> > I have a WB with 10 worksheets.
> > At the time I did this WB,  I also created a Macro that had the task to 
> > change the format of all the sheets.
> > Today, I have decided to hide some of the sheets and the macro does no 
> > longer work.
> > I guess this is because it cannot find the sheets which are hidden.
> > 
> > My question is: Is there a way to allow the Macro to work as before, meaning 
> > to continue changing the format of the hidden sheets as well?
> > Something like a condition that says, if Sheet XY is hidden then look for it 
> > into etc.
> > 
> > Thank you
> > Alex
> > 
0
Metallo (10)
1/18/2006 7:56:13 PM
Sorry I took so long to get back....I was at work before and got busy, and
am home now....
This is crude, but does perform the desired task.....enough to give you the
idea, anyway.

Sub CheckIfHidden()
 Sheets("sheet1").Select
'Do Your code here to sheet1 which was not hidden
    If Sheets("sheet2").Visible = False Then
      Sheets("sheet2").Visible = True
      Sheets("sheet2").Select
      'Do your code here to sheet2 if it was  hidden
      Sheets("sheet2").Visible = False
    Else
      Sheets("sheet2").Select
      'Do your code here to sheet2 if it was not hidden
    End If
End Sub

Vaya con Dios,
Chuck, CABGx3



"Metallo" <Metallo@discussions.microsoft.com> wrote in message
news:E47E04B1-9C6D-4ED3-9CF0-B2B6D615B62F@microsoft.com...
> Chuck,
>
> Easy to say, but I have no clou on how to instruct the macro to check if
the
> sheet is hidden or not.
> Can you give me a sample so that I understand how it works and then I can
> apply it to my macro?
>
> Thanks man
>
> Vai con Dio, indeed!
> Alex
>
> "CLR" wrote:
>
> > You can reach your end goal by altering your Macro to first check each
sheet
> > to see if it is Hidden, and if so then unhide it > perform your
reformatting
> > > and then rehide it and go on to the next.......if the sheet is not
hidden,
> > then just perform the reformatting and go on.....
> >
> > Vaya con Dios,
> > Chuck, CABGx3
> >
> >
> >
> > "Metallo" wrote:
> >
> > > Hi,
> > >
> > > I have a WB with 10 worksheets.
> > > At the time I did this WB,  I also created a Macro that had the task
to
> > > change the format of all the sheets.
> > > Today, I have decided to hide some of the sheets and the macro does no
> > > longer work.
> > > I guess this is because it cannot find the sheets which are hidden.
> > >
> > > My question is: Is there a way to allow the Macro to work as before,
meaning
> > > to continue changing the format of the hidden sheets as well?
> > > Something like a condition that says, if Sheet XY is hidden then look
for it
> > > into etc.
> > >
> > > Thank you
> > > Alex
> > >


0
croberts (1377)
1/19/2006 12:14:39 AM
Chuck,

Thank you, i see what you mean now.
I will try and see.

Cheers
Alex

"CLR" wrote:

> Sorry I took so long to get back....I was at work before and got busy, and
> am home now....
> This is crude, but does perform the desired task.....enough to give you the
> idea, anyway.
> 
> Sub CheckIfHidden()
>  Sheets("sheet1").Select
> 'Do Your code here to sheet1 which was not hidden
>     If Sheets("sheet2").Visible = False Then
>       Sheets("sheet2").Visible = True
>       Sheets("sheet2").Select
>       'Do your code here to sheet2 if it was  hidden
>       Sheets("sheet2").Visible = False
>     Else
>       Sheets("sheet2").Select
>       'Do your code here to sheet2 if it was not hidden
>     End If
> End Sub
> 
> Vaya con Dios,
> Chuck, CABGx3
> 
> 
> 
> "Metallo" <Metallo@discussions.microsoft.com> wrote in message
> news:E47E04B1-9C6D-4ED3-9CF0-B2B6D615B62F@microsoft.com...
> > Chuck,
> >
> > Easy to say, but I have no clou on how to instruct the macro to check if
> the
> > sheet is hidden or not.
> > Can you give me a sample so that I understand how it works and then I can
> > apply it to my macro?
> >
> > Thanks man
> >
> > Vai con Dio, indeed!
> > Alex
> >
> > "CLR" wrote:
> >
> > > You can reach your end goal by altering your Macro to first check each
> sheet
> > > to see if it is Hidden, and if so then unhide it > perform your
> reformatting
> > > > and then rehide it and go on to the next.......if the sheet is not
> hidden,
> > > then just perform the reformatting and go on.....
> > >
> > > Vaya con Dios,
> > > Chuck, CABGx3
> > >
> > >
> > >
> > > "Metallo" wrote:
> > >
> > > > Hi,
> > > >
> > > > I have a WB with 10 worksheets.
> > > > At the time I did this WB,  I also created a Macro that had the task
> to
> > > > change the format of all the sheets.
> > > > Today, I have decided to hide some of the sheets and the macro does no
> > > > longer work.
> > > > I guess this is because it cannot find the sheets which are hidden.
> > > >
> > > > My question is: Is there a way to allow the Macro to work as before,
> meaning
> > > > to continue changing the format of the hidden sheets as well?
> > > > Something like a condition that says, if Sheet XY is hidden then look
> for it
> > > > into etc.
> > > >
> > > > Thank you
> > > > Alex
> > > >
> 
> 
> 
0
Metallo (10)
1/19/2006 9:33:02 AM
Reply:

Similar Artilces:

Macro warning with no macros
I have a workbook that when I try to open it I get the warning tellin me it contains macros and asking whether I want to Enable or Disabl them. I put no macros, no VB scripts, nothing at all in the workboo other than standard Excel formulas and some charts. I developed it i Excel 2002, SP-2, but have moved it back and forth between tw computers, the other which has Excel 97. Regardless of whether Enable or Disable or change the security settings so as not to get th warning, once the workbook is open even if I go t Tools-Macro-Macros... it lists no macros. How can I find out what's cau...

How can I share my calendar but keep details hidden?
In Outlook 2007 how can I share my calendar with others but conceal the detailed information of the meeting? Basically, only sharing the subject and location. What type of email account do you have? -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com/ Outlook Tips by email: mailto:dailytips-subscribe-request@lists.outlooktips.net EMO - a weekly newsletter about Outlook and Exchange: mailto:EMO-NEWSLETTER-SUBSCRIBE-REQUEST@PEACH.EASE.LSOFT.COM Poll: What version of Outlook do you u...

Macro
Can anybody tell me how to kick off a macro automatically as file is opened? Regards ...

Macro
Version: 2008 Operating System: Mac OS X 10.4 (Tiger) Processor: intel Hi, I'm thinking of buying Mac: Office 2008, but before I do I want to check that I will be able to download Scritpsmart collection of templates without any glitches: <http://www.bbc.co.uk/writersroom/scriptsmart/faq.shtml> Does anyone know if I can do this? Regards, SP. In article <ee98ff5.-1@webcrossing.caR9absDaxw>, StregaItalia@officeformac.com wrote: > Version: 2008 > Operating System: Mac OS X 10.4 (Tiger) > Processor: intel > > Hi, > > I'm thinking of buying Mac: Of...

irritating hidden hotkey
Hi, I am experimenting with hotkeys in Excel. Most of the time a key-combination doesn't result immediately in something visible or handy. But now I have come across a hot that is really disturbing. By pressing the tab-key excel normally selects the next column. Now, however excel selects the first column out of the monitor-window. So for instance from column to P. I don't remember the key combination and I have not found any option where to set the tab-jump tot devault. please help. Tools>Options>Transition. Uncheck "Transition navigation keys" Gord Dibben Ex...

Help with macro/and or formula?
Perhaps this is a silly question, but i just can't figure out how t format this worksheet. The problem is that a lot of the cells hav numbers in them with negative signs in the back instead of in the fron (ie. 23-) and i was wondering if anyone knew of a macro/formula i coul use to quickly fix this problem for all the cells. I would b extremely grateful. Thanks -- brefed1 ----------------------------------------------------------------------- brefed15's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=3557 View this thread: http://www.excelforum.com/showthre...

Attached Toolbars Macros
Excel 2003 I have a custom tool bar, this tool bar has several items, each item is pointing to a VBA code. This tool bar is attached to the worksheet. I've copied this spreadsheet to several computers. After I copied the spreadsheet I decided to rename the spreadsheet, after I renamed the spreadsheet the Toolbar Item's macros were still pointing to the old name, I reasigned each tool bar item to the current spreadsheet, saved the spreadsheet and everything was working on my computer, but when I re-copied the new spreadsheet to other computers and I clicked on the Toolbar Item...

Run macro automatically.
How do I make a macro run automatically when a worksheet it is attached to is loaded? right click on the sheet tab>view code>left window worksheet>right window activate -- Don Guillett SalesAid Software donaldb@281.com "Excel macro" <Excel macro@discussions.microsoft.com> wrote in message news:DD7AF1E3-9263-4523-AC49-A43ABA1AB9D0@microsoft.com... > How do I make a macro run automatically when a worksheet it is attached to is > loaded? I am unable to find "activate " when I right click on worksheet. ( i assume that you are referring to the windo...

unhide multiple sheets
How can I unhide several sheets all at once instead of one sheet at time ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com You can do that with a macro, if it is the same sheets then you can record a macro while you unhide them and then next time run that macro.. Or you can use what I use Sub UnhideSheet() Application.ScreenUpdating = False Dim mySht As Worksheet For Each mySht In ActiveWorkbook.Worksheets mySht.Visible = True Next mySht Application.ScreenUpdating = True ...

Protected sheets and running macros
i have a sheet with a macro ran by a normal button at the top. Howeve when i protect the worksheet where ever i click on the sheet the macr executes. Can any one offer any advice on how to stop this? Thanks Robert -- Message posted from http://www.ExcelForum.com hi, i am not able to reproduce the problem, hence i may not be able t provide a panacea for that issue. here is what i suggest. i have a sheet that has a macro that is run when a control toolbo button (that is, not a form button) is clicked. this sheet is protected based on the user logged in. what i have don is to protect t...

Macro Freezes Reading Pane
I have a macro that Sends/Receives Tasks from Project Server into Outlook Tasks. Everything is working fine, except one weird thing that happens. I have the Timer set on the macro and it starts as soon as Outlook starts. The macro gets the tasks from ProjectServer every hour. As soon as the macro starts running the Reading pane freezes in the Inbox. If i stop the macro then Reading pane is back to normal. Can anyone please tell me if there is something I can do in VBA to fix this annoying issue. Thanks a lot ...

Macro to remove rows?
Hi, I receive thousands of rows of data from an extract that comes from a database. The data extract automatically generates page headers that need to be removed, and I would love to automate this process. The headers do have a pattern to them, but I'm not clever enough to figure out a good way to use that to write a macro. The first row of the header starts with hyphens ------------------------------- Then there's a variable number of rows of header data to delete followed by another row of hyphens ------------------------------- Then 2 additional rows that must be deleted. The nu...

Tracking Sheet help.
Sheet 3 of my workbook is a tracking sheet. In cell B8 (sheet 3) I enter the amount of time's that I've made an entry of time on sheet 2. The times I enter on sheet 2 are used to track vehicles that are passing a set location. On sheet 2 I enter the times in column D. The vehicle's I count have numbers to ID them in column F. The numbers look like 401N1501, 401N1514, 401S1516, 401S1600. The part of the number I need to associate with my count is the first four digits, 401N, 401S. Is it possible to do this? Yep, use a sumproduct function to count using the left 4 digits as...

Calling on a macro within a macro!
Hey All!! Quick Question - How do you call up a macro within a current macro? I have one big macro and I need it to jump to several other macros when it runs! Does it matter where the other macros are stored or is it better to have them all in one module? Help appreciated Thnx! Hi Mellowe, '=============>> Public Sub Main() 'Your code Call One 'your code End Sub '<<============= '=============>> Public Sub One() MsgBox "Hi from One" End Sub '<<============= > Does it matter where the other macros are stored or ...

shortcut keys to macros
Hi, Is it at all possible to assign shortcut keys to macros in Outlook? Thx, Hans ...

help Unable to record Macro !!!!!!!
I want to record a macro in excel.But as soon as I click record Macro it says "unable to record" macro. Got no help in excel help.I do this same thing in word and it's working. Please help It's urgent for me !!!1 Have a look here http://groups.google.com/groups?as_epq=unable%20to%20record&as_ugroup=microsoft.public.excel.* -- Don Guillett SalesAid Software donaldb@281.com "ash" <anonymous@discussions.microsoft.com> wrote in message news:3e0b01c42ae5$45333e00$a401280a@phx.gbl... > I want to record a macro in excel.But as soon as I click > record...

Macro that password protects a sheet
I am attempting to create a macro that can open a protected sheet, change something, and then protect it again. I continue to have an issue with the macro not entering the password. Is this possible to do/fix? Thanks, Ryan ..open password="mypassword" -- Don Guillett SalesAid Software donaldb@281.com "Ryan" <Ryan@discussions.microsoft.com> wrote in message news:D4780ED8-CA1D-4284-97BC-3576160D998E@microsoft.com... > I am attempting to create a macro that can open a protected sheet, change > something, and then protect it again. I continue to have an iss...

Footer Macro?
Hi Months ago I read a Public Sub Macro that read the selection of a drop down list in a combo box and placed it in the center Footer at the same time it also placed the date in the right Footer and tme in the left footer. I have searched most of the regular sites including this one and cannot find it anywhere --- Can anyone help with my search. Any help much appreciated Cheers ---- Mully ...

Hidden data
Why does my chart disappear when I hide the data on the sheet? -- Brisbane Rob ------------------------------------------------------------------------ Brisbane Rob's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=25096 View this thread: http://www.excelforum.com/showthread.php?threadid=528675 Hi, If the actual chartobject disappears uncheck the move and size with cells property of the chartobject. If you data just disappears then with the chart selected use the menus Tools > Options > Chart > Plot Visible cells only. Cheers Andy Brisbane Rob wr...

Keyboard Shortcut in Macro
Hi all i'v created macro with Keyboard Shortcut Ctrl+b . now i want to change it to Ctrl+z how can i do it . regards Tools-->Macro-->Macros. Select (don't open!) your macro, and hit the Options button. :) ************ Hope it helps! Anne Troy www.OfficeArticles.com "osaka78" <osaka78@discussions.microsoft.com> wrote in message news:1721A458-212D-4446-8209-494A459EE428@microsoft.com... > Hi all > i'v created macro with Keyboard Shortcut Ctrl+b . now i want to change it > to > Ctrl+z > how can i do it . > > regards THE MACRO IS NO...

Macros have been disabled but there is no macro
when I open a specific doc the info bar at the top says "Macros have been disabled", but when I hit Alt+F11 I can't find any VB or a module to remove. Why is it telling me about macros? Other docs don't give me this prompt. I thought I might have to enable macros to see the code. When I enabled macro, it said "do you want to save changes to this doc?" it flickered and came back as if immediately reopened. Any ideas? I could copy and paste the text into a new doc but I'd be interested to be able to strip off this problem. The doc is an internal IT ...

Two workers on the same Excel sheet
Hi, Pretend the situation that one worker ( 'person x' ) have made update in a Excel datasheet and send it to the worker of the administration 'person y' ). When 'person y' recieves the datasheet, he makes so changes in the datasheet. Two hours later 'person x' finds out some errors in the last datashee he sent, updates it again and send it once again to 'person y'. How can 'person y' import ( after confirming the changes ) the ne changes made of 'person x' to his datasheet ( the first datasheet h got )? Thank -- Message posted fro...

Run multiple Macros or macros from within other macros ?
I would like to run multiple macros at startup. What code should be used in the Private Sub Application_Startup command in the ThisOutlookSession area ? If the names of my macros were below what would the code to look like ? Macro1 Macro2 Macro3 I have looked at the samples from previous posts and cannot determine how to make them apply specifically to my needs. In Excel you can use the Run "Macro1" line and it would run that macro. Run does not work in Outlook I suppose because I kept getting an error. **** Also - What code is needed to execute a macro from w...

Startup macro
Is it possible for automatic start of macro in moment when excel file is opening. I mean when I open excel file specific macro will be immediately automatic started. Zeno option explicit sub auto_Open() call yourspecificmacronamehere end sub Zeno wrote: > > Is it possible for automatic start of macro in moment when excel file is > opening. > I mean when I open excel file specific macro will be immediately automatic > started. > > Zeno -- Dave Peterson ...

Macro Question #8
Hi: I have a group of several files with a simple macro that automatically goes to a specific worksheet at the time the file is opened. The code is as follows: Private Sub Workbook_Open() Worksheets ("TITLE").Select Range ("a1").Select End Sub The macro works properly when a single file is opened, but when I try to open several of the files at the same time I get the following error message: Run Time Error 1004 Select method of Worksheet Class Failed All of the files do open, but the macro appears to run on only the first file selected. All of the other files open ...