exit

  1. L

    Exiting a nested for cycle

    Hello guys, I sometimes have for loops nested in for loops, but once i find my answer id like all of the loops to exit, not just the current one. My current code looks like: For Each item1 In fulllist1 For Each item2 In fullList2 If item2.Text = "hit" Then done = True...
  2. I

    Merge two Worksheet_Change codes

    Hi, I habe these two codes. Private Sub Worksheet_Change(ByVal Target As Range)If Intersect(Target, Range("J1:M3")) Is Nothing Then Exit Sub Application.EnableEvents = False Target.Value = UCase(Target.Value) Application.EnableEvents = True End Sub Private Sub Worksheet_Change(ByVal Target As...
  3. I

    Could you advise on this code please

    Morning, I see this code a few times on my worksheets but dont know what its actually doing,please can you advise. Private Sub Worksheet_Change(ByVal Target As Range) With Target If .Column = 1 Then Exit Sub If .Column = 7 Then Exit Sub If .Count = 1 And Not...
  4. D

    VBA stuck in a loop I can't get out of

    Hi all I’ve been given the code below which seems to do almostexactly what I want it to do but I’d like to make a couple of changes which iswhere I’m stuck AsI understand it this code identifies if a cell has been changed then if thetotal in row 21 is higher than that of row 23 provides a...
  5. albertc30

    Returning msgbox error even though there ain't one set?!

    Hi all. The code bellow checks customers sheet for a customers name then if it already exists, then it returns a message and then customer textbox is cleared and set focus to. however, the focus is not working but instead it's focused on the next textbox. Private Sub tbnbna_AfterUpdate()If...
  6. P

    If Textbox.value ="", Then Go to next line of code, if not do this

    Hello, I am attempting to run code in a user form that determines the difference between two dates (in two text boxes) and place that number in a third textbox. I am doing this for a large number of textboxes on the form. I want the code to check if either of the two date text boxes is blank...
  7. K

    code help

    The following code never gets to the ELSE and always displays the message box. I suspect that it is because when I print the variables lastrow is right justified and rowfound is left justified so they are not both numbers. But I am not sure and if so I don't know how to fix it. 'Get Row...
  8. K

    Runtime Error -2147417848 (80010108) Automation Error

    Getting the following error: Runtime error -2147417848 (80010108) Automation Error The object invoked has dicsonnected from its clients. <code><code> Set ie = CreateObject("InternetExplorer.Application") Application.ScreenUpdating = False If Sheets("Adrenalin").Range("C3").Value = "" Or...
  9. T

    Slow and Hungry Code

    Okay so I've been learning as I go, the below code all works fine... as long as you have a powerful machine to run it and plently of time. Does anyone have any suggestions as to how I can make it more efficent and faster? Sub Printdata() Dim Passport As Worksheet Dim Tally As Worksheet Dim...
  10. N

    Updating Cell Value with changing other cell value of same row

    Hello sir, I'm using code:Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("R2:R21")) Is Nothing Then Cells(Target.Row, "S") = BS2AD(Cells(Target.Row, "R")) Exit Sub ElseIf Not Intersect(Target, Range("S2:S21")) Is Nothing Then Cells(Target.Row, "R") =...
  11. K

    how to keep from exiting sub with this code?

    For Each nP In Range(Cells(1, 14), Cells(cntRowsN, 14)) ' E-H-S INCIDENT TALLY ' COPY THE ROWS IN THE "EHS" COLUMN (ON THE ANALYTICS SHEET) AND PASTE ONTO THE TOTAL COLUMN (A2) ON THE "REPORTS" WORKSHEET: If cntRowsN >= 1 Then 'copies just the rows in column F and pastes them on the...
  12. VBE313

    Exit Do Loop at Certain Cell?

    How do you exit a Do Loop at a certain cell?
  13. K

    problem with exiting loop after 'If Then Else' procedure is executed...

    Dim iP As Variant Dim cntRows As Long cntRows = ActiveWorkbook.Worksheets("ANALYTICS").Range("F65536").End(xlUp).Row For Each iP In Range(Cells(1, 6), Cells(cntRows, 16)) If cntRows <= 15 Then MsgBox "there are less than 15 rows in your tally" 'Exit Sub End If If cntRows >...
  14. J

    Speeding up VBA Vlookup on Worksheet Change

    Hi, i have the following which on worksheet change, looks up the value in column A and outputs the matching data from Data Sheet it uses the FIND vba function but im unsure if theres a better way to do this as it can lag on fast input: Private Sub Worksheet_Change(ByVal Target As Range) Dim...
  15. I

    Please can you explain this code

    Morning, I have an issue on one worksheet & trying to find the reason why. Please could you explain what the supplied code actually does. Please could you then advise another way to write it. Thanks Private Sub Worksheet_Change(ByVal Target As Range) Dim C As Range, d As Range Set d =...
  16. M

    New to VBA: Go to Next If Statement

    I have some code that I am messing with for a pet project at work for an inventory form. I have the pictures of an item with macros for a mouse click to remove one from the "on hand" inventory. in Sheet 1. From there, I have on Sheet 2 the "inventory database" which includes the Quantity on...
  17. T

    How can i get my macro to run corretly when the worksheet deactivates

    Hi Everyone, got a problem here. I have 35 sheets all of which I need to run the same macro when I exit them. but when I exit them they are no longer the active sheet so it all goes wrong. i'm hoping there might be a way to change activesheet to something else and solve this any ideas? below...
  18. W

    change trigger from Worksheet_Change to Woorksheet_Calaculate

    I'm trying to change the trigger from Worksheet_Change to worksheet_calculate cannot get it to work. Private Sub Worksheet_Change(ByVal target As Range) If target.Cells.Count <> 1 Then Exit Sub If target.Address <> "F13" Then Exit Sub If (target.Value >= 0) And (target.Value < 0) ThenExit...
  19. RobbieC

    Custom 'cancel' on Auto_Close

    Hi there, I have a 'very customised' spreadsheet which I have replaced all alert boxes with customised userforms. I have a form called CloseAreYouSure which is triggered when Auto_Close kicks in. This just confirms whether or not the application is to close down with a 'yes' & 'no' button: Sub...
  20. W

    Excel VBA delete picture

    I want to delete picture based on cell value If Target.Value = "Yes" Then delete RedArrow picture should only show GreenArrow picture not both If Target.Value = "No" Then delete GreenArrow picture should only show RedArrow picture not both<strike></strike> Private Sub Worksheet_Change(ByVal...

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