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

I can select Column A with either Columns("A").Select or Columns(1).Select

I can select Columns A-C with Columns("A:C").Select. However,
Columns(1:3).Select does not work.

How can I select a range of columns using a numeric reference?

--Alan


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Selecting multiple columns

Columns(1).Resize(,3).Select


Range(Columns(1),Columns(3)).Select

Are two ways.

--
Regards,
Tom Ogilvy


"Kiloran" wrote in message
...
I can select Column A with either Columns("A").Select or Columns(1).Select

I can select Columns A-C with Columns("A:C").Select. However,
Columns(1:3).Select does not work.

How can I select a range of columns using a numeric reference?

--Alan




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default Selecting multiple columns

Hi Alan,

Try something like this,

Sub SelectColumn(stcol As Integer, lastcol As Integer)

If lastcol = stcol And lastcol 0 And stcol 0 And stcol <= 256 And
lastcol <= 256 Then

Columns(stcol).Resize(, lastcol - stcol + 1).Select

Else
'for demo purpose

MsgBox "Couldn't select Col."

End If

End Sub

Sub test()
SelectColumn 1, 3 ' A-C
End Sub



Regards,
Shah Shailesh
http://members.lycos.co.uk/shahweb/


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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 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 xnman Excel Programming 2 November 18th 03 01:52 PM
Selecting Multiple Columns Jay[_12_] Excel Programming 1 October 13th 03 05:35 PM


All times are GMT +1. The time now is 12:50 PM.

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

About Us

"It's about Microsoft Excel"