Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default fill array from active cell

I have tried to find how to do this from previous posts but my limited
programming skills have not been able to accomplish it.

What I need to do, is take a cell in excel with data and put into an array

i.e. Cell data contains 3,6,8 and I need an 1x3 array arrary(1)=3
array(2)=6, array(3)=8

I want to be able to select a cell and then run the macro

Here is what I have so far (it doesnt work):

Sub FindAreas()

Dim areas()


areas = Split(ActiveCell.Value, ",")

Range("B1", "B3").Select
For i = 1 To 3
ActiveCell(i) = areas(i)
Next i

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default fill array from active cell

Try this perhaps...

Sub Test()
Dim var As Variant
Dim lng As Long

var = Split(ActiveCell.Value, ",")
For lng = LBound(var) To UBound(var)
ActiveCell.Offset(0, lng + 1).Value = var(lng)
Next lng
End Sub
--
HTH...

Jim Thomlinson


"christinalou" wrote:

I have tried to find how to do this from previous posts but my limited
programming skills have not been able to accomplish it.

What I need to do, is take a cell in excel with data and put into an array

i.e. Cell data contains 3,6,8 and I need an 1x3 array arrary(1)=3
array(2)=6, array(3)=8

I want to be able to select a cell and then run the macro

Here is what I have so far (it doesnt work):

Sub FindAreas()

Dim areas()


areas = Split(ActiveCell.Value, ",")

Range("B1", "B3").Select
For i = 1 To 3
ActiveCell(i) = areas(i)
Next i

End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,069
Default fill array from active cell

Try this:

Sub FindAreas()
Dim i As Long, areas
areas = Split(ActiveCell.Value, ",")
Range("B1").Select
For i = 0 To UBound(areas)
ActiveCell.Cells(i + 1, 1) = areas(i)
Next i
End Sub

Hope this helps,

Hutch

"christinalou" wrote:

I have tried to find how to do this from previous posts but my limited
programming skills have not been able to accomplish it.

What I need to do, is take a cell in excel with data and put into an array

i.e. Cell data contains 3,6,8 and I need an 1x3 array arrary(1)=3
array(2)=6, array(3)=8

I want to be able to select a cell and then run the macro

Here is what I have so far (it doesnt work):

Sub FindAreas()

Dim areas()


areas = Split(ActiveCell.Value, ",")

Range("B1", "B3").Select
For i = 1 To 3
ActiveCell(i) = areas(i)
Next i

End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 783
Default fill array from active cell

christinalou wrote:
I have tried to find how to do this from previous posts but my limited
programming skills have not been able to accomplish it.

What I need to do, is take a cell in excel with data and put into an array

i.e. Cell data contains 3,6,8 and I need an 1x3 array arrary(1)=3
array(2)=6, array(3)=8

I want to be able to select a cell and then run the macro

Here is what I have so far (it doesnt work):

Sub FindAreas()

Dim areas()


areas = Split(ActiveCell.Value, ",")

Range("B1", "B3").Select
For i = 1 To 3
ActiveCell(i) = areas(i)
Next i

End Sub



Sub FindAreas()
Range(ActiveCell(1, 2), ActiveCell(1, 4)).Value = Split(ActiveCell, ",")
End Sub
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
Can you fill an array from the contents of a single cell Dan Troxell Excel Programming 6 May 26th 06 06:32 PM
Active Cell Fill Colour uplink600[_11_] Excel Programming 5 March 8th 06 03:38 PM
Identifying the Active Fill Color Steve Conary Excel Discussion (Misc queries) 3 December 9th 04 04:45 AM
Fill down from active cell Neal Excel Programming 1 November 3rd 04 08:18 AM
Fill from active cell Neal Excel Programming 0 November 3rd 04 03:26 AM


All times are GMT +1. The time now is 10:09 AM.

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"