Hi Everyone. It's been a while since I was on here last, but ran into an interesting problem with a nested for loop that I cannot solve. Hoping someone here will know the answer. I placed breakpoints in my code at the For x=1 to 10 line and after to see where run-time is ending. For some reason VBA is not executing the loop at all. Does anyone know what I'm missing? Thanks in advance.
sub help()
Dim x As Integer
Dim y As Integer
Dim lastcell As Long
Dim ws As Worksheet
Dim wscurr As Worksheet
Dim gcounter As Long
Dim hcounter As Long
Dim num10000(1 To 10) As Double
Set ws = Sheets("ECLMadj")
Set wscurr = Sheets("10000-yr")
wscurr.Select
Range("A265536").End(xlUp).Select
lastcell = ActiveCell.Row
Range("A1").Select
num10000(1) = 2210
num10000(2) = 2220
num10000(3) = 2230
num10000(4) = 2240
num10000(5) = 2250
num10000(6) = 2310
num10000(7) = 2320
num10000(8) = 2330
num10000(9) = 2340
num10000(10) = 2350
gcounter = 1
x = 1
y = 1
For x = 1 To l0
hcounter = 1
For y = 2 To lastcell
wscurr.Select
If Range("A" & y).Value = num10000(x) And Range("B" & y).Value >= 12 And Range("C" & y).Value <= 39 Then
wscurr.Range("A" & y & ":F" & y).Copy Destination:=ws.Range(Cells(hcounter, gcounter))
hcounter = hcounter + 1
End If
Next y
gcounter = gcounter + 8
Next x
End Sub