Use one of these in the sheet module where cell a1 contains the number of the month.
Sub hidecols() Columns.Hidden = False mc = Range("a1") + 1 Range(Cells(1, mc), Cells(1, 12)).EntireColumn.Hidden = True End Sub
'Automatic every time you change cell a1 Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address <> "$A$1" Then Exit Sub Columns.Hidden = False mc = Target + 1 Range(Cells(1, mc), Cells(1, 12)).EntireColumn.Hidden = True End Sub
-- Don Guillett SalesAid Software dguillett1[ at ]austin.rr.com <hamad.fatima[ at ]gmail.com> wrote in message news:1156260462.231698.127570[ at ]m73g2000cwd.googlegroups.com...
[Quoted Text] >I have a serious problem with excel programming and i am not able to > figureout how to do the following funtions. > > I have 24 columns. names Jan -Dec ( Actual) then Jan- Dec (Forecast). > There is one reference cell A1 ( for current month). > - If A1= Jan, I want macro to hide FEB-DEC 9 Actual , and leave > FEB-DEC (forecast). > -If A1= FEB , I want macro to unhide FEB Actual and hide MAR-Dec ( > actual) and at the same time clear contents in FEB (forecast) and hide > feb (forecast ). > > ANd so on > > > I would really appreciate if somene could help me figure out this > problem. > > Thanks >
|