View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Doug Glancy Doug Glancy is offline
external usenet poster
 
Posts: 770
Default Combo column identifier

Dave,

This assumes you have the code to find your variable column:

Sub test()

Dim top_col As Range
Dim cols_to_hide As Range

Set top_col = Columns("AA") 'code to determine top_col will replace this

Set cols_to_hide = Range(top_col, Columns("AC"))
cols_to_hide.Hidden = True

End Sub

hth,

Doug

"davegb" wrote in message
oups.com...
I'm working on a set of worksheets in a workbook where I want to use a
macro to Hide certain columns before I protect them send them out to
end users. The starting column that I want to hide varies, depending on
how many columns of data there are in that particular sheet. On every
sheet, however, the columns I want to hide start with one that has the
text "Top 10" in the third row. The hidden columns end at Column AC in
all sheets.
My current thinking is to write a macro that selects row 3 and finds
the work "Top". Set the column as a variable "TopCol", then have XL
hide all columns from that column to Column AC. But I can't figure out
how to tell XL I want to select all columns from a variable, TopCol, to
a constant "AC". I know how to do ("AA:AC"), but what is the syntax
when one of the column identifiers is a variable, the other the normal
alpha label?