How to define a variable as a range

mtheriault2000

Well-known Member
Joined
Oct 23, 2008
Messages
826
Hello

How can i define a variable:Listing as a range value

My actual code
Code:
dim Listing as range
listing = Sheets("Formulaire").Range("OrderListing").Address

listing.Offset(ct, C) = TwsLink.GET_ORDER_VAL(v, 1)

The actual code is not functioning

Martin
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
When assigning a value to an object variable the keyword Set has to be used.
Objects are things like Worksheets,CheckBoxes, and Ranges.

So the syntax for having the variable Listing refer to the named range OrderListing would be

Code:
Dim Listing As Range

Set Listing = Sheets("Formulaire").Range("OrderListing")
This assumes that there is a named range OrderListing in the workbook that does refer to some cells on the sheet Formulaire.
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,828
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top