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: 29
Default Using a macro to hide columns

Hi there,
I am trying to write a macro which will hide columns that do not have a "1"
in row 2. This is the code I am using, but there is something wrong with it.
Is anyone able to help?
Dim rng As range
Dim c As range
For Each c In Intersect(ActiveSheet.UsedRange,
ActiveSheet.range("a2:bd2"))
If InStr(1, c.Text, 0) 0 Then
If rng Is Nothing Then
Set rng = c
Else
Set rng = Union(rng, c)
End If
End If
Next c
rng.Columns.Hidden = True
 
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 to Hide columns whatzzup Excel Discussion (Misc queries) 3 October 23rd 09 01:39 PM
Need a macro to hide certain columns Dallman Ross Excel Discussion (Misc queries) 12 October 19th 06 05:58 PM
I set up a macro to hide/unhide columns. It hides more columns Lori Excel Programming 1 September 6th 06 04:08 PM
hide columns macro xkarenxxxx Excel Programming 5 June 2nd 06 05:27 PM
macro to hide columns Shooter Excel Worksheet Functions 2 September 27th 05 09:04 PM


All times are GMT +1. The time now is 01:46 PM.

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

About Us

"It's about Microsoft Excel"