Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Read through Range and copy Cell data to Array

I am trying to calculate status of a range based on:
When Data is present in Col1, Select Cell data for Col1 & Col 3 of same
row and write it to an arrary. I'd appreciate any help or direction
with this.

I've tried to set it up to: Read through a range of cells (currently
A2:J13), and where A1 is not empty, select the contents of A2 and E2
and write them to an array.

So far I have:

Sub TestStatusArray()
Dim TestCaseID As String
Dim Status As Boolean
Dim R As Integer
R = 2

Do While Not (IsEmpty(Cells(R, 1)))
Cells(R, 1).Copy << getting lost here


Loop
End Sub

I can't seem to figure out how to extract the contents of the cells and
and write
A2 to TestCaseID and E2 to Status.

Ideally, this data will then later be populated on a separate
worksheet.

I welcome any suggestions/recommendations/reading links.

Thanks,
Leigh

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Read through Range and copy Cell data to Array

One way:

Public Sub TestStatusArray()
Dim TestCaseID As String
Dim Status As Boolean
Dim R As Long
R = 2
Do While Not IsEmpty(Cells(R, 1).Value)
TestCase = Cells(R, 1).Value
Status = Cells(R, 5).Value
'Do something here
Loop
End Sub

but it sounds more like you want something along these lines:

Public Sub TestStatusArray()
Dim rSource As Range
Dim rDest As Range

With Sheets("SourceSheet")
Set rSource = .Range("A2:A" & _
.Range("A" & .Rows.Count).End(xlUp).Row)
End With

With Sheets("DestSheet")
Set rDest = .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0)
End With

With rSource
Set rDest = rDest.Resize(.Rows.Count, .Columns.Count)
rDest.Value = .Value
rDest.Offset(0, 1).Value = .Offset(0, 4).Value
End With
End Sub

(of course, there are many, many ways to accomplish the same thing).



In article . com,
"missleigh" wrote:

I am trying to calculate status of a range based on:
When Data is present in Col1, Select Cell data for Col1 & Col 3 of same
row and write it to an arrary. I'd appreciate any help or direction
with this.

I've tried to set it up to: Read through a range of cells (currently
A2:J13), and where A1 is not empty, select the contents of A2 and E2
and write them to an array.

So far I have:

Sub TestStatusArray()
Dim TestCaseID As String
Dim Status As Boolean
Dim R As Integer
R = 2

Do While Not (IsEmpty(Cells(R, 1)))
Cells(R, 1).Copy << getting lost here


Loop
End Sub

I can't seem to figure out how to extract the contents of the cells and
and write
A2 to TestCaseID and E2 to Status.

Ideally, this data will then later be populated on a separate
worksheet.

I welcome any suggestions/recommendations/reading links.

Thanks,
Leigh

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
How to Read Worksheet Data into VBA Array? Peter Bernadyne Excel Discussion (Misc queries) 1 July 12th 06 05:19 PM
Can a cell refer to range name/array of data previously set? Courreges Excel Discussion (Misc queries) 1 June 12th 06 02:45 PM
How do i read Selection.Shapes.Range(Array(i)? Harry Excel Programming 2 September 6th 05 03:46 PM
Read a range to an array Microsoft Forum Excel Programming 4 January 23rd 05 05:23 PM
Read Range Data into Array Stratuser Excel Programming 1 April 26th 04 06:46 PM


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

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"