Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am getting an error message of "Next without For" on the Next
RowCount Statement at the end of the following code. Can anyone tell me why? Frank Sub Macro() LastRw = 54 NewRowCount = 38 For RowCount = NewRowCount To LastRw Step 2 Ahead = Cells(RowCount, 5) - Cells(RowCount, 4) If Ahead = 0 Then Cells(RowCount, 6) = 0 ElseIf Ahead < 0 Then Cells(RowCount, 6) = Ahead * -1 Ahead = 0 LastColumn = 18 NewColumnCount = 8 For ColumnCount = NewColumnCount To LastColumn Step 2 If Ahead = 0 Then Cells(RowCount, ColumnCount) = Cells(RowCount + 1, ColumnCount) - Cells(RowCount + 1, ColumnCount - 2) ElseIf Ahead 0 And Ahead Cells(RowCount + 1, ColumnCount) - Cells(RowCount + 1, ColumnCount - 2) Then Cells(RowCount, ColumnCount) = 0 Ahead = Ahead - (Cells(RowCount + 1, ColumnCount) - Cells(RowCount + 1, ColumnCount - 2)) ElseIf Ahead 0 And Ahead < Cells(RowCount + 1, ColumnCount) - Cells(RowCount + 1, ColumnCount - 2) Then Cells(RowCount, ColumnCount) = Cells(RowCount + 1, ColumnCount) - Cells(RowCount + 1, ColumnCount - 2) - Ahead Ahead = 0 End If Next ColumnCount Next RowCount End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
run time error 1004 general odbc error excel 2003 vba | Excel Programming | |||
Counting instances of found text (Excel error? Or user error?) | Excel Worksheet Functions | |||
Error Handling - On Error GoTo doesn't trap error successfully | Excel Programming | |||
Form Err.Raise error not trapped by entry procedure error handler | Excel Programming | |||
Automation Error, Unknown Error. Error value - 440 | Excel Programming |