Hi All,
I am quite new to VBA and currently trying to create a Goal Seek Loop 11 row, skip 50 rows, and then run for another 11 row and so forth until last active cell.
For e.g. run goal seek row 20 to 30, skip row 31-84, run goal seek again row 85 to 95, and so forth.
I got a code that runs every "H" cells but not skipping. Would offset be the way to go if so where does it fit?
Thanks.
Regards,
Siontk
I am quite new to VBA and currently trying to create a Goal Seek Loop 11 row, skip 50 rows, and then run for another 11 row and so forth until last active cell.
For e.g. run goal seek row 20 to 30, skip row 31-84, run goal seek again row 85 to 95, and so forth.
I got a code that runs every "H" cells but not skipping. Would offset be the way to go if so where does it fit?
Code:
Sub Run_Goalseekerloop()
Dim cr As Integer
Dim cr2 As Integer
Dim cnt As Integer
cnt = 0
cr = 5
cr2 = 5
Worksheets("BESR Calc Q2 2016").Activate
For cr = 5 To ActiveSheet.UsedRange.Rows.Count
For cr2 = 5 To ActiveSheet.UsedRange.Rows.Count
Cells(cr, 63).GoalSeek Goal:=0, ChangingCell:=Cells(cr2, 8)
cnt = cnt + 1
If cnt = 1 Then
cr = cr + 1
cr2 = cr2 + 0
cnt = 0
End If
Next
Next
End Sub
Thanks.
Regards,
Siontk