ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro (https://www.excelbanter.com/excel-programming/284002-macro.html)

Michael[_23_]

Macro
 
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

Chip Pearson

Macro
 
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


"Michael" wrote in message
...
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 Mitchelson

Macro
 
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



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 07:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com