Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Selecting Multiple Columns

How can I select multiple columns in Excel using VBA when
the number of columns is a variable? I have a variable
that tells me how many columns to select. How can I make
VB select the number of columns (for hiding) based on the
variable that I have?

Jay
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Selecting Multiple Columns

Try this Jay

Sub test()
Dim var As Integer
var = 3
Columns(ActiveCell.Column).Resize(, var).Hidden = True
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"Jay" wrote in message ...
How can I select multiple columns in Excel using VBA when
the number of columns is a variable? I have a variable
that tells me how many columns to select. How can I make
VB select the number of columns (for hiding) based on the
variable that I have?

Jay



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
Selecting nonadjacent columns? Barnsie Excel Worksheet Functions 1 February 3rd 10 02:28 AM
Selecting different multiple columns rcg Excel Worksheet Functions 1 September 26th 06 05:58 PM
Selecting Multiple Columns in a Named Selection Griffithpt Excel Worksheet Functions 0 August 9th 06 10:54 PM
Selecting multiple columns for subtotals CEG Excel Discussion (Misc queries) 2 January 31st 06 06:50 PM
selecting columns in a worksheet nuti Excel Worksheet Functions 1 January 12th 06 01:06 PM


All times are GMT +1. The time now is 06:11 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"