Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default cell contents into an array

i have a column with acct #s in it. each cell can have multiple accts. they are
separated by a comma. how do i get these into an array so i can access each acct
# as an element?

i tried using arr=array(range("E3").value, but it created 1 element with the 3
acct #'s. tried to use split, but it only brought in the first one.

there may be only 1 acct #, there may be 15 in ach cell.

--


Gary



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default cell contents into an array

i think i got it

--


Gary


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
i have a column with acct #s in it. each cell can have multiple accts. they are
separated by a comma. how do i get these into an array so i can access each
acct # as an element?

i tried using arr=array(range("E3").value, but it created 1 element with the
3 acct #'s. tried to use split, but it only brought in the first one.

there may be only 1 acct #, there may be 15 in ach cell.

--


Gary





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 284
Default cell contents into an array

Gary,

The split function should work but it needs to be fed a text string, not a
numerical value. Unfortunately, if you just select the column and use
'Format Cells', the numbers will be converted to text but Excel will drop
the commas (at least it did when I tested on my system). I'd copy the
column, to a new column already formatted as text or even copy, format the
current column and paste the values over the old ones but where the cells
are formatted as text (that should convert to a text string and retain the
commas).

This sub should work:

Sub ArrayFromCell()
arrCell = Split(Range("E3").Value, ",")
For A = 0 To UBound(arrCell)
MsgBox arrCell(A)
Next A
End Sub

Steve


"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
i have a column with acct #s in it. each cell can have multiple accts. they
are separated by a comma. how do i get these into an array so i can access
each acct # as an element?

i tried using arr=array(range("E3").value, but it created 1 element with
the 3 acct #'s. tried to use split, but it only brought in the first one.

there may be only 1 acct #, there may be 15 in ach cell.

--


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
does an array contain contents of cell cooper_yonk New Users to Excel 2 November 27th 10 01:29 PM
#N/A if cell contents not part of an array MichaelR Excel Discussion (Misc queries) 5 June 28th 08 03:09 AM
How can I Import picture contents into Excell cell array numbers? CLR Excel Worksheet Functions 0 November 29th 06 06:38 PM
Can you fill an array from the contents of a single cell Dan Troxell Excel Programming 6 May 26th 06 06:32 PM
use cell reference,whose contents= a table array name for Vlookup Sonic Excel Worksheet Functions 2 March 27th 06 08:29 AM


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