LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 395
Default Passing sheet (using codename) to separate sub as optional paramet

I have a large, convoluted workbook. With some of my subs that bring in raw
data from other files, I want to unhide the sheet where that data is pasted
just so I can review it (without unhiding all sheets). There are also some
subs where I want to unhide every worksheet in the workbook.

So, I wrote a sub that I thought would handle both, but I'm getting errors
when I try to call it, and it also fails when I place the cursor inside the
sub and try to run it directly.

Sub ShowAllSheets(Optional IndSht As Worksheet)
Dim sht As Worksheet
'name<codename, but irrelevant -just determines if a sheet was passed to
the sub
If (IndSht.Name) < "" Then
IndSht.Visible = xlSheetVisible
Else
For Each sht In Excel.ActiveWorkbook.Worksheets
sht.Visible = xlSheetVisible
Next
End If
End Sub

When I try to run the code above, it pops up a dialogue box with a list of
macros to run, rather than just running this one as I would have expected.

Also, when I try to call the sub (below) I get a run time error 438, object
doesn't support this property or method

Sub ALoad_FinRTs()
ShowAllSheets (Sheet15)
'do stuff
End Sub

I think I have more than one problem here, but I'm not sure what the problem
is, so I can't experiment with solutions...

Thanks!
Keith
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting Sheet By Codename Kris_Wright_77 Excel Programming 4 December 16th 09 04:23 PM
Codename passing Nigel[_2_] Excel Programming 3 December 10th 07 12:50 PM
change sheet codename Gary Keramidas Excel Programming 4 March 5th 06 12:54 AM
Selecting a sheet by codename Dr.Schwartz Excel Programming 3 September 3rd 04 02:15 PM
Using sheet codename problems Dustin Carter Excel Programming 1 February 20th 04 10:26 PM


All times are GMT +1. The time now is 08:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"