![]() |
columns hidden
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 |
columns hidden
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 |
columns hidden
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 |
columns hidden
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 |
All times are GMT +1. The time now is 12:18 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com