I have a problem with this code
It show me : Compile erro - Esle without if
I put if then it show me the line in red
how to fix this problem
and Thank you for help
It show me : Compile erro - Esle without if
I put if then it show me the line in red
how to fix this problem
and Thank you for help
Code:
Private Sub CommandButton1_Click()
Dim j As Integer
j = 8
For i = i - 8 To i - 5
Sheets("sheet2").Cells(j, 5).Value = Sheets("sheet1").Cells(i, 1).Value
Sheets("sheet2").Cells(j + 3, 1).Value = Sheets("sheet1").Cells(i, 3).Value
Sheets("sheet2").Cells(j + 3, 2).Value = Sheets("sheet1").Cells(i, 4).Value
Sheets("sheet2").Cells(j + 3, 3).Value = Sheets("sheet1").Cells(i, 5).Value
Sheets("sheet2").Cells(j + 3, 4).Value = Sheets("sheet1").Cells(i, 6).Value
Sheets("sheet2").Cells(j + 6, 4).Value = Sheets("sheet1").Cells(i, 7).Value
Sheets("sheet2").Cells(j + 6, 3).Value = Sheets("sheet1").Cells(i, 8).Value
Sheets("sheet2").Cells(j + 6, 9).Value = Sheets("sheet1").Cells(i, 9).Value
j = j + 16
Next
If CommandButton1.Enabled = False Then CommandButton1.Enabled = True
CommandButton1.Caption = "Forward " & i & " - " & i + 3
'i = i - 4
If i - 4 < 8 Then CommandButton2.Enabled = False
Else: CommandButton2.Caption = "backward " & i - 8 & " - " & i - 5
End If
End sub