Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hello,
To hide some columns, I'm now using this VB code; Private Sub CommandButton4_Click() Columns("F:AG").Select Selection.EntireColumn.Hidden = True CommandButton1.Activate End Sub Now I also want to hide some columns behind AH:AU. So the columns selection has to be "F:AG" and AV:ZZ, but how do I put that in the code? Can anybody tell me, it will be very simple but I just don't know! Gtrz Marc |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Use a comma between the quotes to have more then one range of columns hidden. Change the columns below as necessary. Private Sub CommandButton4_Click() Range("F:AG,AV:ZZ").Select Selection.EntireColumn.Hidden = True CommandButton1.Activate End Sub Cheers, -- Kevin Lehrbass www.spreadsheetsolutions4u.com "minostrada" wrote: hello, To hide some columns, I'm now using this VB code; Private Sub CommandButton4_Click() Columns("F:AG").Select Selection.EntireColumn.Hidden = True CommandButton1.Activate End Sub Now I also want to hide some columns behind AH:AU. So the columns selection has to be "F:AG" and AV:ZZ, but how do I put that in the code? Can anybody tell me, it will be very simple but I just don't know! Gtrz Marc |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It is good code practice to avoid selecting things if at all possible, and
in most cases you can avoid it. Second, you make a list of ranges by separating them with a comma. Private Sub CommandButton4_Click() Range("F:AG, AV:ZZ").EntireColumn.Hidden = True CommandButton1.Activate End Sub Mike F "minostrada" wrote in message ... hello, To hide some columns, I'm now using this VB code; Private Sub CommandButton4_Click() Columns("F:AG").Select Selection.EntireColumn.Hidden = True CommandButton1.Activate End Sub Now I also want to hide some columns behind AH:AU. So the columns selection has to be "F:AG" and AV:ZZ, but how do I put that in the code? Can anybody tell me, it will be very simple but I just don't know! Gtrz Marc |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thanks mike and kevin
"Mike Fogleman" wrote: It is good code practice to avoid selecting things if at all possible, and in most cases you can avoid it. Second, you make a list of ranges by separating them with a comma. Private Sub CommandButton4_Click() Range("F:AG, AV:ZZ").EntireColumn.Hidden = True CommandButton1.Activate End Sub Mike F "minostrada" wrote in message ... hello, To hide some columns, I'm now using this VB code; Private Sub CommandButton4_Click() Columns("F:AG").Select Selection.EntireColumn.Hidden = True CommandButton1.Activate End Sub Now I also want to hide some columns behind AH:AU. So the columns selection has to be "F:AG" and AV:ZZ, but how do I put that in the code? Can anybody tell me, it will be very simple but I just don't know! Gtrz Marc |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
2007 Worksheet, Hidden Columns, .CSV Format Saves Hidden Column Da | Excel Discussion (Misc queries) | |||
Copy and Paste with hidden columns remaining hidden | Excel Discussion (Misc queries) | |||
Hidden rows columns won't stay hidden | Excel Worksheet Functions | |||
Hidden Columns No Longer Hidden after Copying Worksheet? | Excel Discussion (Misc queries) | |||
How to keep hidden columns hidden using protection | Excel Discussion (Misc queries) |