H
HM
Greetings All,
Thanks alot Dick for the initial help. I thought I had it, but i was unable
to modify this to exactly work for me.
I have the following macro code which retrieves data from a second
worksheet:
Dim i As Long, j As Long
Dim Rng As Range
Dim Sh As Worksheet
Set Sh = ThisWorkbook.Sheets("Schedule")
Set Rng = ThisWorkbook.Sheets("Sheet1").Range("C1")
Rng.Formula = "=Schedule!C1"
For i = 2 To 19 Step 6
For j = 3 To 5
Rng.Offset(i + j - 4, 0).Formula = _
"=Schedule!" & Sh.Cells(i, j).Address(0, 0)
Rng.Offset(i + j - 3, 0).Formula = _
"=Schedule!" & Sh.Cells(i + 1, j).Address(0, 0)
Next j
Next i
End Sub
The above code returns the following locations
points to: retreived from:
(2,0) (2,3)
(3.0) (3,3)
(3,0) (2,4)
(4,0) (3,4)
(4,0) (2,5)
(5,0) (3,5)
(5,0) (8,3)
(6,0) (9,3)....etc..
What I need it to return is the following:
points to: retreived from:
(2,0) (2,3)
(3.0) (3,3)
(4,0) (2,4)
(5,0) (3,4)
(6,0) (2,5)
(7,0) (3,5)
(8,0) (8,3)
(9,0) (9,3)....etc
Hope that makes sense? Is there a simple change I can make to this code?
Thank you,
HM
Thanks alot Dick for the initial help. I thought I had it, but i was unable
to modify this to exactly work for me.
I have the following macro code which retrieves data from a second
worksheet:
Dim i As Long, j As Long
Dim Rng As Range
Dim Sh As Worksheet
Set Sh = ThisWorkbook.Sheets("Schedule")
Set Rng = ThisWorkbook.Sheets("Sheet1").Range("C1")
Rng.Formula = "=Schedule!C1"
For i = 2 To 19 Step 6
For j = 3 To 5
Rng.Offset(i + j - 4, 0).Formula = _
"=Schedule!" & Sh.Cells(i, j).Address(0, 0)
Rng.Offset(i + j - 3, 0).Formula = _
"=Schedule!" & Sh.Cells(i + 1, j).Address(0, 0)
Next j
Next i
End Sub
The above code returns the following locations
points to: retreived from:
(2,0) (2,3)
(3.0) (3,3)
(3,0) (2,4)
(4,0) (3,4)
(4,0) (2,5)
(5,0) (3,5)
(5,0) (8,3)
(6,0) (9,3)....etc..
What I need it to return is the following:
points to: retreived from:
(2,0) (2,3)
(3.0) (3,3)
(4,0) (2,4)
(5,0) (3,4)
(6,0) (2,5)
(7,0) (3,5)
(8,0) (8,3)
(9,0) (9,3)....etc
Hope that makes sense? Is there a simple change I can make to this code?
Thank you,
HM