Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Range to Array. Why doesn't this line work? 1

Status
Not open for further replies.

davedave24

Programmer
Aug 26, 2010
113
GB
I'm trying to put a range (column B in a worksheet) into an array when the form loads. All I require is that it reads down column B until there is an empty cell, and adds those values to the array rngBags. This only returns the first value though (I'm only just learning arrays so bear with me)

Code:
'at the top
Dim rngBags as Variant

'in userform_intialize
Set rngBags = Worksheets("Customers").Range("B1").End(xlDown)

Do I need to use ReDim or something?
 


Hi,

Your code defines ONE cell.
Code:
With Worksheets("Customers")
   Set rngBags = Range(.Range("B1"), .Range("B1").End(xlDown))
end with



Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top