excel vba please check this code that it is not working

I got this error message:

Compile Error End If without block if

in the last End If instruction

Would you please share with me your answers.

Than you in advance. I really appreciate your help.

            If rompeControl = "" Then
            rompeControl = sheet_E.Range("H" & nf).Value
            wkFecha = sheet_E.Range("G" & nf).Value
            wkRuc = sheet_E.Range("J" & nf).Value
            If (sheet_E.Range("J" & nf) > "90000000") Then nc = 99
            Else
            sheet_E.Range("R" & nf) = Len(sheet_E.Range("J" & nf))
            nc = sheet_E.Range("R" & nf).Value
            End If

            wkLocal = sheet_E.Range("N" & nf).Value
            wkDebito = 0#
            wkCredito = 0#
            wkDebitoT = 0#
            wkCreditoT = 0#
            wkTipoId = "04"
            wkTipoDoc = "18"
        End If

Upvotes: 0

Views: 39

Answers (1)

user2480047
user2480047

Reputation:

It should be:

 If (sheet_E.Range("J" & nf) > "90000000") Then 
     nc = 99
 Else
     sheet_E.Range("R" & nf) = Len(sheet_E.Range("J" & nf))
     nc = sheet_E.Range("R" & nf).Value
 End If

You can put it like this If (sheet_E.Range("J" & nf) > "90000000") Then nc = 99 only in case of not having an else.

Upvotes: 2

Related Questions