View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Neal[_3_] Neal[_3_] is offline
external usenet poster
 
Posts: 7
Default unhiding columns problem

I think you are absolutely right, I need to restate what I need. Sorry about my
inexperience with VBA.

I have a workbook that tracks employee hours in different labor catagories on a
daily basis. There are 37 labor catagories and therefore 37 columns and 7
worksheets (Mon-Sun). On some job projects, all of the 37 labor catagories are
not needed. Perhaps 3 or 4 could be eliminated. Those that can be eliminated
are not grouped together. They could be any of the 37. I need a macro that will
allow me to hide the labor catagory columns that I don't need on all 7 days and
also unhide them when needed. Ideally I would want to list the labor catagories
on another worksheet and perhaps put a X in the column next to the catagory that
I would like hidden and then run the macro and it would hide the columns with a
X. I have tried this by adding a If Then argument to a recorded macro but it
only hides the columns and does not unhide them. Also, I would have to have a
macro for each catagory using this method. Is there any easier way? Can
someone point me in the right direction?

Your help is appreciated
Neal


"Tom Ogilvy" wrote in message
...
What is it you want to do. Perhaps you just need to state what you want to
do specifically in plain english.

Regards,
Tom Ogilvy


Neal wrote in message
...
I suppose I did not make myself clear on what was needed. I will have to

study
VBA more before I ask questions because this makes no sense to me. I

have
figured out how to do it by recording a macro but I will have to add 72

macros
to the worksheet to accomplish it. I was hoping for an easier solution.

Neal
.
"Tom Ogilvy" wrote in message
...
sh is a reference to the sheet where you want a column unhidden.
Columns(21) refers to the 21st column.

? columns(1).address
$A:$A
? columns(21).address
$U:$U

So column U.

Just used 21 as an example since you didn't specify which column.

--
Regards,
Tom Ogilvy



"Neal" wrote in message
...
Thanks for the response but I am a novice at this and I can't figure

out
what
sh.columns(21) means. Could you please explain it and how I am to use

it?

Thank you

Neal


"Tom Ogilvy" wrote in message

for each sh in Worksheets
sh.Columns(21).Hidden = False
Next

or

for each sh in Activewindow.SelectedSheets
sh.Columns(21).Hidden = False
Next


--
Regards,
Tom Ogilvy

"Neal" wrote in message
...
I have a workbook with seven worksheets. I have recorded several
macros
that
have selected all the worksheets and then cleared the contents in

a
range.
I
have used this same method to hide a column in all the worksheets
successfully
but when I try to unhide a column, it only works on one of the
worksheets.
What
code can I use to to unhide the selected column on all seven
worksheets.
Thanks
Neal