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: 360
Default hide column script, range address?

The script runs through all the cells on a sheet looking for an #na, if
there is an
#na in all the rows in that column it seeks to hide the row. The loop works
and there are values in
x and hidecol. From running this in the debugger it looks like it goes
across the rows not down?

It however doesn't hide those columns even if the hidecol boolean is true.
I think it is because the address for x is wrong ? I tried selecting it
first and also entirecolumn = hidden and that didn't work.
Range(x).Select
columns(x).entirecolumn.hidden = true
tia,




Sub Format_VOD_HideColumns()

Dim UsedRange1 As Range
Dim UsedRows1 As Long
Dim UsedCol1 As Long
Dim x As Integer
Dim HideCol As Boolean
Dim C As Range

Set UsedRange1 = ActiveSheet.UsedRange
UsedRows1 = UsedRange1.Rows.Count
UsedCol1 = UsedRange1.Columns.Count

Application.ScreenUpdating = False

For x = 1 To UsedCol1
HideCol = True
For Each C In Intersect(Range(Cells(12, x), Cells(64000, x)), UsedRange1)

If C.Value < "N/A" Then

HideCol = False
Exit For
End If
Next C
If HideCol = True Then


*** Columns(x).Hidden = True***


End If
Next x





Application.ScreenUpdating = True

End Sub

 
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 rows with zero in specifc column range David Excel Discussion (Misc queries) 1 April 20th 10 08:10 PM
Hide/unhide TAB Script [email protected] Excel Discussion (Misc queries) 1 June 11th 07 09:30 PM
Pivot Table Range Address, Row & Column numbers Edmund Excel Programming 1 October 19th 06 07:56 AM
Hide my VB script? Peter[_28_] Excel Programming 3 November 19th 04 10:21 AM
Hide a cell using Windows Script John Doe[_5_] Excel Programming 1 October 11th 04 04:57 AM


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