Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 97
Default Maco code doesn't work. Why?

I am using Excel 2003. I have inserted the following code into a macro to
hide any sheets where cell N1="x". This is the only code in the macro. When I
run I get an error (below).

Dim wks as worksheet
for each wks in activesheet.worksheets
if lcase(wks.range("n1").value) = lcase("x") then
wks.visible = xlsheethidden
end if
next wks

ERROR: Object doesn't support this property or method (Error 438)

Can someone help?

Thanks,
Joe M.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Maco code doesn't work. Why?

Hi,

Try this

Dim wks As Worksheet
For Each wks In ActiveWorkbook.Worksheets
If LCase(wks.Range("n1").Value) = "x" Then
wks.Visible = xlSheetHidden
End If
Next wks

Mike

"Joe M." wrote:

I am using Excel 2003. I have inserted the following code into a macro to
hide any sheets where cell N1="x". This is the only code in the macro. When I
run I get an error (below).

Dim wks as worksheet
for each wks in activesheet.worksheets
if lcase(wks.range("n1").value) = lcase("x") then
wks.visible = xlsheethidden
end if
next wks

ERROR: Object doesn't support this property or method (Error 438)

Can someone help?

Thanks,
Joe M.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Maco code doesn't work. Why?

Sorry about the typo!

Joe M. wrote:

I am using Excel 2003. I have inserted the following code into a macro to
hide any sheets where cell N1="x". This is the only code in the macro. When I
run I get an error (below).

Dim wks as worksheet
for each wks in activesheet.worksheets
if lcase(wks.range("n1").value) = lcase("x") then
wks.visible = xlsheethidden
end if
next wks

ERROR: Object doesn't support this property or method (Error 438)

Can someone help?

Thanks,
Joe M.


--

Dave Peterson
Reply
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
Protect a maco in master copy [email protected] Excel Discussion (Misc queries) 2 March 30th 07 04:20 PM
macro security warning when no maco in workbook Nuts Excel Discussion (Misc queries) 1 March 28th 06 11:21 AM
Is there any way to have a maco click a command button ChairMan Excel Discussion (Misc queries) 0 March 23rd 06 03:58 PM
Auto run maco/change behavior of save/close m schmitz Excel Discussion (Misc queries) 0 February 10th 06 04:00 AM
A simple maco . . . Steve New Users to Excel 3 January 2nd 05 10:36 PM


All times are GMT +1. The time now is 10:40 AM.

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"