Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default 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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default 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



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
Array: Counting multiple values within array Trilux_nogo Excel Worksheet Functions 4 April 16th 07 03:12 AM
fill array [email protected][_2_] Excel Programming 7 March 20th 06 01:01 PM
fill down array to last available row [email protected] Excel Worksheet Functions 10 May 19th 05 10:52 PM
Fill values into a listbox matching selected values from a combobox Jon[_19_] Excel Programming 4 January 25th 05 04:25 PM
Fill an Array with String values John Michl[_2_] Excel Programming 6 May 14th 04 07:10 PM


All times are GMT +1. The time now is 04:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"