![]() |
fill array with only values
if you set an array to a range of cells, how to you fill it with only cells
that have text or a value in them? arr2 = Worksheets("emp").Range("L2:L" & lastrow).Value i only want cells that have text in them to populate the array -- Gary |
fill array with only values
The array takes the dimensions of the range, if it didn't then you could not
reference the array back the cell. To load only populated cells you will need to read them into the array using a loop, and you may also want to record the cell reference into another dimension of the array storing where the value resides on the sheet. -- Cheers Nigel "GKeramidas" wrote in message ... if you set an array to a range of cells, how to you fill it with only cells that have text or a value in them? arr2 = Worksheets("emp").Range("L2:L" & lastrow).Value i only want cells that have text in them to populate the array -- Gary |
fill array with only values
Hi GKeramidas,
Try this one : Sub ArrayIn() For Each rng In Worksheets("emp").Range("L2:L7") Arr2 = Arr2 & "," & rng.Value Next rng Arr2 = Mid(Arr2, 2) Debug.Print Arr2 end sub Rgds, Halim GKeramidas menuliskan: if you set an array to a range of cells, how to you fill it with only cells that have text or a value in them? arr2 = Worksheets("emp").Range("L2:L" & lastrow).Value i only want cells that have text in them to populate the array -- Gary |
fill array with only values
got it thanks
-- Gary wrote in message oups.com... Hi GKeramidas, Try this one : Sub ArrayIn() For Each rng In Worksheets("emp").Range("L2:L7") Arr2 = Arr2 & "," & rng.Value Next rng Arr2 = Mid(Arr2, 2) Debug.Print Arr2 end sub Rgds, Halim GKeramidas menuliskan: if you set an array to a range of cells, how to you fill it with only cells that have text or a value in them? arr2 = Worksheets("emp").Range("L2:L" & lastrow).Value i only want cells that have text in them to populate the array -- Gary |
All times are GMT +1. The time now is 09:44 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com