store variable
Hi Bob
Thanks for the effort but nothing is happening, the macro is not hiding any
colums.
What I need for the macro to do is the following
1) Go to row 6 (where my data starts0
2)from row 6 search and identify by column the last column that contains
data(as every month i add a new column.)
3)Offset the last column(iLastCol) by 6
4)Hide columns from column b to iLastCol-6 (Column A contains the Row headers)
Thanks in anticipation
"Bob Phillips" wrote:
The selecting is not necessary, just state your start point in the code, I
had use A1. Try
Sub HideCols()
Dim iLastCol As Long
Dim iStartCol As Long
iLastCol = Cells(6, Columns.Count).End(xlToLeft).Column
iStartCol = iLastCol - 12
With Columns(iStartCol).Resize(, 6)
.Hidden = Not .Hidden
End With
End Sub
--
HTH
Bob Phillips
(remove nothere from email address if mailing direct)
"Bob Phillips" wrote in message
...
Sub HideCols()
Dim iLastCol As Long
Dim iStartCol As Long
iLastCol = Cells(1, Columns.Count).End(xlToLeft).Column
iStartCol = iLastCol - 12
With Columns(iStartCol).Resize(, 6)
.Hidden = Not .Hidden
End With
End Sub
--
HTH
Bob Phillips
(remove nothere from email address if mailing direct)
"keen learner" wrote in message
...
Assistance Please
jan feb mar apr may june july aug sep oct nov dec 12
mth
Bakkies 5 9 56 45 34 13 87 90 54 34 34 54
519
cars 7 8 23 34 76 9 19 23 35 56 38
34
467
trucks 23 56 67 45 76 32 54 23 56 23 54 54
762
I have a excell spreadsheet setup as above and every month i add a new
colum
I would like to write a macro that can enable me to display 6 month data
and
12 months data alternately or in other words hide and unhide unnecssary
colums
Please help
|