mysticmario
Active Member
- Joined
- Nov 10, 2021
- Messages
- 323
- Office Version
- 365
- Platform
- Windows
Hi, For some reason when vbNo is pressed the code inlucding input boxes still executes. How can I break it? and move on to next
With ws
execution?
VBA Code:
Set cell = rng.Find(what:="Płyta", LookIn:=xlFormulas, _
lookat:=xlPart, SearchOrder:=xlByRows, searchdirection:=xlNext, _
MatchCase:=False, SearchFormat:=False)
If cell <> "" And cell.Offset(, 1) <> 0 Then
MsgBox "Dodać płytę HDF? ", vbYesNo
If vbYes Then
kolor = InputBox("biała czy surowa?", "Kolor HDF")
ile = InputBox("Ile szt?", "Ilość")
With ws
T = Application.WorksheetFunction.CountA(.Range("B11:B30,K11:K30,T11:T30"))
If T >= 60 Then MsgBox "Full line.Please check data": Exit Sub
If T > 0 Then
X = Int(T / 20)
lr = .Cells(30, S(X)).End(3).Row
Else
lr = 10
X = 0
End If
End With
lr = lr + 1
If lr < 31 Then
If X <= 2 Then
ws.Cells(lr, S(X)).Value = "Płyta HDF" & kolor
ws.Cells(lr, S(X)).Offset(, 1).Value = ile & "szt"
Else
MsgBox "Check the return area": Exit Sub
End If
Else
X = X + 1
lr = lr - 20
If X <= 2 Then
ws.Cells(lr, S(X)).Value = "Płyta HDF" & kolor
ws.Cells(lr, S(X)).Offset(, 1).Value = ile & "szt"
Else
MsgBox "Check the return area": Exit Sub
End If
End If
End If
End If