Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
UB UB is offline
external usenet poster
 
Posts: 120
Default Passing Arguments in Excell

Hi,
Is there a way , I can pass arguments in Excell worksheet object ' Range'
when writing VBA code.
Ex: worksheet.range("a1:c1")
Can I pass arguments to the range object for the cell reference ( a1 & c1).
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,440
Default Passing Arguments in Excell

If you don't use the quotes, you can use variables. A mix is also possible.

Let's say VarA' value is "A" and VarB's value is "B2"

Then you could use Range(VarA & "2:" & VarB) to mean Range("A2:B2")

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"ub" wrote in message ...
| Hi,
| Is there a way , I can pass arguments in Excell worksheet object ' Range'
| when writing VBA code.
| Ex: worksheet.range("a1:c1")
| Can I pass arguments to the range object for the cell reference ( a1 & c1).
| Thanks


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
UB UB is offline
external usenet poster
 
Posts: 120
Default Passing Arguments in Excell

Hi
How do I write the code , when I want to pass the value of a cell in the
range object.
Example, I have stored a value of a cell in a variable 'I'.
Now I want my range to be from A1 to C(the variable 'I').
Please advise.

"Niek Otten" wrote:

If you don't use the quotes, you can use variables. A mix is also possible.

Let's say VarA' value is "A" and VarB's value is "B2"

Then you could use Range(VarA & "2:" & VarB) to mean Range("A2:B2")

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"ub" wrote in message ...
| Hi,
| Is there a way , I can pass arguments in Excell worksheet object ' Range'
| when writing VBA code.
| Ex: worksheet.range("a1:c1")
| Can I pass arguments to the range object for the cell reference ( a1 & c1).
| Thanks



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,624
Default Passing Arguments in Excell

One way:

Dim rMyRange As Range
Set rMyRange = ActiveSheet.Range("A1:C" & I)

In article ,
ub wrote:

How do I write the code , when I want to pass the value of a cell in the
range object.
Example, I have stored a value of a cell in a variable 'I'.
Now I want my range to be from A1 to C(the variable 'I').

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
Passing Arguments in Excell function UB Excel Discussion (Misc queries) 2 February 13th 07 03:19 PM
Passing a UDF as an argument to a UDF puff Excel Discussion (Misc queries) 3 February 23rd 06 09:46 PM
Passing Variable Number of Arguments to a Sub blatham Excel Discussion (Misc queries) 4 December 10th 05 10:36 AM
Passing Variables Jeff Excel Discussion (Misc queries) 1 November 4th 05 06:46 PM
passing arguments from an excel macro to a word macro KWE39 Excel Discussion (Misc queries) 1 July 7th 05 03:56 PM


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