Hiding columns

D

davethewelder

hi, I have a spreadsheet with 20 columns but the report which supplies this
spreadsheet will supply less than the 20 coumns of information. I want to
graph this data but I cannot figure out how to hide the blank columns.
Can anyone help?

Cheers,

Davie
 
R

Ron de Bruin

Hi davethewelder

Do I understand you correct that you want to hide the columns that are blank with a macro.
 
D

davethewelder

Hi, thanks for the promt reply. In the report there are a possibility of 19
column headings but depending on the selection criteia the number will vary.
All the blank rows will be at the end and I wish to eliminate them to ensure
they do not appear in the graph.

Davie
 
D

davethewelder

Don, all the blank columns will be at the end of the range. I want to
eliminate them and then set the graph parameters to the resulting range.

Davie
 
D

Don Guillett

something like this should do it for you. Assumes last data has something in
row TWO
Sub hidecolumns()
lc = Cells(2, Columns.Count).End(xlToLeft).Column + 1
'MsgBox lc
Range(Cells(1, lc), Cells(1, 20)).EntireColumn.Hidden = True
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top