Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Help with macro - deja vu

Somebody helped me build the short macro below which, I am pretty
sure, worked in an old file. I copied it into a new file and it is
crashing on the 4th command. runtime error 1004

I have no recollection of what

Selection.SpecialCells(xlCellTypeFormulas, 16).Select

does!

I have range-named a row "test.hide.column.by.DA" with some empty
entries at the left and right but, in the middle, it has cells with
either the number 1 or the text #N/A in them. My recollection is that
it is supposed to hide every column that has the #N/A result in it.
Can anyone help me figure out what is wrong. I don't see any cell
comments.

Sub hideColumns()
Application.ScreenUpdating = False
ActiveSheet.Unprotect
Application.Goto Reference:="test.hide.column.by.DA"
Selection.SpecialCells(xlCellTypeFormulas, 16).Select
'if the macro bombs at the line below, it may be due to cell
comments!!, see 09-07-06 newsgroup post
Selection.EntireColumn.Hidden = True

'this protects but allows column and row width changes
ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
Scenarios:=True _
, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True

Application.ScreenUpdating = True
Range("a2").Select
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Help with macro - deja vu

Ok, I think I figured it out. It looks like it would need to be a
real #N/A, not just a text string.

Never mind but thanks!
D

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Help with macro - deja vu


You specifically looked through formulas by using: xlCellTypeFormulas

xlcelltypeconstants
would have been my next try.

DA wrote:

Ok, I think I figured it out. It looks like it would need to be a
real #N/A, not just a text string.

Never mind but thanks!
D


--

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
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Macro not showing in Tools/Macro/Macros yet show up when I goto VBA editor [email protected] Excel Programming 2 March 30th 07 07:48 PM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 04:04 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"