Macro

  • Thread starter Thread starter Michael
  • Start date Start date
M

Michael

Hi All
I have a large financial spreadsheet that is sent to me
from another source. I have written a macro to remove all
unwanted data and make a summarized printout. However,
each month the spreadsheet gets one column wider due to
the extra month. How can I rewrite my macro so that it
hides this extra month when it runs. eg, My macro hides
columns C to G, next month it will have to hide C to H,
etc, etc.
Hope you can help
Regards
Michael
 
Michael,

Try something like


Range(Range("A1"), Cells(1, Columns.Count).End(xlToLeft)(1, 0)) _
.EntireColumn.Hidden = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Thanks Chip
Can you explain how this function works.
I am not aware of some of these commands
The extra column each month will always be the second last column, if
that makes any difference.
Regards
Michael
 
Back
Top