multiple loops help codeing

Asche

Board Regular
Joined
Jun 25, 2008
Messages
50
I broke them up into groups but basically I need to make a look that for each string, to read in arrays.
so in the strzonerept instead of having all that there is a loop that will turn the strzonerept(1) = Cells(4, 2).Value, in to strzonerept(2) = Cells(4, 3).Value and keep incrementing.

strzonerept(1) = Cells(4, 2).Value
strzonerept(2) = Cells(4, 3).Value
strzonerept(3) = Cells(4, 4).Value
strzonerept(4) = Cells(4, 5).Value
strzonerept(5) = Cells(4, 6).Value
strzonerept(6) = Cells(5, 2).Value
strzonerept(7) = Cells(5, 3).Value
strzonerept(8) = Cells(5, 4).Value
strzonerept(9) = Cells(5, 5).Value
strzonerept(10) = Cells(5, 6).Value
strzonerept(11) = Cells(6, 2).Value
strzonerept(12) = Cells(6, 3).Value
strzonerept(13) = Cells(6, 4).Value
strzonerept(14) = Cells(6, 5).Value
strzonerept(15) = Cells(6, 6).Value


strzonetab(1) = Cells(10, 2).Value
strzonetab(2) = Cells(10, 3).Value
strzonetab(3) = Cells(10, 4).Value
strzonetab(4) = Cells(10, 5).Value
strzonetab(5) = Cells(10, 6).Value
strzonetab(6) = Cells(11, 2).Value
strzonetab(7) = Cells(11, 3).Value
strzonetab(8) = Cells(11, 4).Value
strzonetab(9) = Cells(11, 5).Value
strzonetab(10) = Cells(11, 6).Value
strzonetab(11) = Cells(13, 2).Value
strzonetab(12) = Cells(13, 3).Value
strzonetab(13) = Cells(14, 4).Value
strzonetab(14) = Cells(14, 5).Value
strzonetab(15) = Cells(14, 6).Value

inttputruns(1) = Cells(9, 7).Value
inttputruns(2) = Cells(9, 8).Value
inttputruns(3) = Cells(9, 9).Value
inttputruns(4) = Cells(9, 10).Value

inttputruns(5) = Cells(9, 11).Value
intzoneruns(1) = Cells(10, 7).Value
intzoneruns(2) = Cells(10, 8).Value
intzoneruns(3) = Cells(10, 9).Value
intzoneruns(4) = Cells(10, 10).Value
intzoneruns(5) = Cells(10, 11).Value
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Perhaps something like this:

Code:
Sub test()
Dim strzonerept(1 To 15)
Dim c As Range, ct As Long
For Each c In Range("B4:F6")
    ct = ct + 1
    strzonerept(ct) = c
Next
ct = 0
End Sub
 
Upvote 0
Dim strzonerept(1 To 15)
Dim c As Range, ct As Long
ct = 0
For Each c In Range("B4:F6")
ct = ct + 1
strzonerept(ct) = c
Next


Dim strzonetab(1 To 15)
Dim D As Range, Dt As Long
Dt = 0
For Each c In Range("B10:F12")
Dt = Dt + 1
strzonetab(Dt) = D
Next


Dim inttputruns(1 To 5)
Dim e As Range, et As Long
et = 0
For Each e In Range("G9:K9")
et = et + 1
inttputruns(et) = e
Next


Dim intzoneruns(1 To 5)
Dim f As Range, ft As Long
ft = 0
For Each f In Range("G10:K10")
ft = ft + 1
intzoneruns(ft) = f
Next


now its telling me that I have a object variable or with block variable not set
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,510
Messages
6,114,044
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top