Group:  Microsoft Excel ยป microsoft.public.excel
Thread: Hid and unhide and clear contents for specific columns at the same time

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Hid and unhide and clear contents for specific columns at the same time
hamad.fatima[ at ]gmail.com 22.08.2006 15:27:42
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

Re: Hid and unhide and clear contents for specific columns at the same time
"Don Guillett" <dguillett1[ at ]austin.rr.com> 22.08.2006 16:26:15
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
>


Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net