smilelover
New Member
- Joined
- Jul 24, 2011
- Messages
- 32
I want to run 2 different IF functions in a single command button
the first one ran, but the 2nd one is not giving any output
how to change it?
Thanks guys
the first one ran, but the 2nd one is not giving any output
how to change it?
Code:
Private Sub CommandButton1_Click()
For i = 1 To 100
For j = 1 To 8
If (IsError(Sheets("4. Freight Per Unit").Cells(8 * i + j - 5, 43))) Then
Sheets("5. SUPPLIER Freight INC").Cells(2 * i, j + 2) = 0
Else
Sheets("5. SUPPLIER Freight INC").Cells(2 * i, j + 2) = Sheets("3. SUPPLIER DUTIES Repriced ").Cells(i + 1, j + 2).Value + Sheets("4. Freight Per Unit").Cells(8 * i + j - 5, 43).Value
End If
Next j
Next i
For k = 1 To 100
For l = 1 To 8
If (Sheets("4. Freight Per Unit").Cells(8 * k + j - 5, 62).Value) < 0.02 Then
Sheets("5. SUPPLIER Freight INC").Cells(2 * i + 1, j + 2) = 0
Else
Sheets("5. SUPPLIER Freight INC").Cells(2 * i + 1, j + 2) = Sheets("3. SUPPLIER DUTIES Repriced ").Cells(i + 1, j + 2).Value + Sheets("4. Freight Per Unit").Cells(8 * i + j - 5, 62).Value
End If
Next l
Next k
End Sub
Thanks guys