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

Help me please,

I need make a multiple selection in VBA but vith variable.

My example which works:
range("A1:A2, C1:C2").select

I need something like:
value = 2
range("A1:A & value, C1:C & value").select

but it does not work, would you help me?

thanx

Michal
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default multiple selection

Michal,

You're close. Try the following:

Dim Value As Long
Value = 2
Range("A1:A" & Value & ",C1:C" & Value).Select


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Michalll" wrote in message
om...
Help me please,

I need make a multiple selection in VBA but vith variable.

My example which works:
range("A1:A2, C1:C2").select

I need something like:
value = 2
range("A1:A & value, C1:C & value").select

but it does not work, would you help me?

thanx

Michal



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default multiple selection

one way:

Dim myValue As Long
myValue = 2
Range("A1:A" & myValue & ",C1:C" & myValue).Select

(it's better not to use VBA keywords, like Value as variable names -
it can get very confusing)



In article ,
(Michalll) wrote:

Help me please,

I need make a multiple selection in VBA but vith variable.

My example which works:
range("A1:A2, C1:C2").select

I need something like:
value = 2
range("A1:A & value, C1:C & value").select

but it does not work, would you help me?

thanx

Michal

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default multiple selection

If you don't like working with strings, perhaps another option might be
something like this...

n = 2
Intersect([A1,C1,E1,G1].EntireColumn, Rows(1).Resize(n)).Select

--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"Michalll" wrote in message
om...
Help me please,

I need make a multiple selection in VBA but vith variable.

My example which works:
range("A1:A2, C1:C2").select

I need something like:
value = 2
range("A1:A & value, C1:C & value").select

but it does not work, would you help me?

thanx

Michal



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
Multiple selection criteria Bigkahuna Excel Worksheet Functions 3 April 28th 09 07:11 PM
Multiple Selection Combo Box Ivor Davies Excel Discussion (Misc queries) 8 April 27th 09 12:43 PM
multiple selection AND Excel Discussion (Misc queries) 9 February 13th 09 07:40 PM
multiple selection.... AND Excel Worksheet Functions 1 February 13th 09 12:35 AM
Copy Selection - Transpose Selection - Delete Selection Uninvisible Excel Discussion (Misc queries) 2 October 23rd 07 04:18 PM


All times are GMT +1. The time now is 09:45 AM.

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"