Hiding columns

  • Thread starter Thread starter davethewelder
  • Start date Start date
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
 
Hi davethewelder

Do I understand you correct that you want to hide the columns that are blank with a macro.
 
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
 
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
 
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
 
Back
Top