Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default 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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default 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





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2007 Worksheet, Hidden Columns, .CSV Format Saves Hidden Column Da Tammy Excel Discussion (Misc queries) 3 April 2nd 09 11:40 PM
Copy and Paste with hidden columns remaining hidden Pendelfin Excel Discussion (Misc queries) 2 February 26th 09 11:35 AM
Hidden rows columns won't stay hidden christie Excel Worksheet Functions 0 September 30th 08 05:44 PM
Hidden Columns No Longer Hidden after Copying Worksheet? EV Nelson Excel Discussion (Misc queries) 1 December 6th 06 05:10 PM
How to keep hidden columns hidden using protection Dave Excel Discussion (Misc queries) 1 March 1st 06 02:20 AM


All times are GMT +1. The time now is 02:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"