Blue_Wings
New Member
- Joined
- Aug 23, 2019
- Messages
- 11
Good morning,
I am a little bit lost here, the code was working fine, I don´t remember changing anything, and suddenly now is giving error.
Already spend a few hours around this matter and I still don´t understand why is giving this error.
Run-time error '91':
Object variable or With block variable not net
Code:
The main purpose of this code is to check a receipt number and then on that line with the "offset" method find a value to test if its "integer" or not "If QtMeses <> Int(QtMeses) Then" and then ask if the user wants to continue.
Why does this "QtMeses" doesn´t keep the value returned by the offset ?
Thank you for the help.
I am a little bit lost here, the code was working fine, I don´t remember changing anything, and suddenly now is giving error.
Already spend a few hours around this matter and I still don´t understand why is giving this error.
Run-time error '91':
Object variable or With block variable not net
Code:
Code:
Private Sub CommandButton1EnviarEmail_Click()
Dim answer As Integer
NumRecibo = Folha9.Range("B13")
ValorRecibo = Folha9.Range("J20")
Dim foundRng As Range
Dim QtMeses As String
Set foundRng = Folha10.Range("A2:A400").Find(NumRecibo)
QtMeses = foundRng.Offset(0, 10).Value ' <<<< The error is on this line
If QtMeses <> Int(QtMeses) Then
answer = MsgBox("Tem a certeza que pretende prosseguir com o valor irregular de " + FormatNumber(ValorRecibo, 2) + "€ ?" & vbCrLf & vbCrLf & "Referente a " + QtMeses + " Meses?", vbYesNo + vbQuestion, "Enviar PDF por Email")
If answer = vbYes Then
Call EscreverReciboEmailemPDF
Exit Sub
Else
Exit Sub
End If
End If
Call EscreverReciboEmailemPDF
End Sub
The main purpose of this code is to check a receipt number and then on that line with the "offset" method find a value to test if its "integer" or not "If QtMeses <> Int(QtMeses) Then" and then ask if the user wants to continue.
Why does this "QtMeses" doesn´t keep the value returned by the offset ?
Thank you for the help.
Last edited by a moderator: