vbNo doesnt stop the execute

mysticmario

Active Member
Joined
Nov 10, 2021
Messages
323
Office Version
  1. 365
Platform
  1. 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
 
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Yeah... sometimes you almost need to know what the answer actually is before you can word the question so that Google knows what you need! :confused:
 
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,626
Members
449,094
Latest member
bsb1122

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top