on error

  1. A

    VBA OnError based on error code

    Hello all, I have some code that has a successful OnError code that provides a message indicating that the file is currently in use by another user (error code 75 would normally populate). What I am trying to do however, is put an if statement in the error code so that if the error isn't...
  2. M

    On error run subroutine

    Hi All Is it, in any way possible to call a subroutine on any error during a macro? I created a macro that does some calculations, afterwards data sheets are hidden as veryhidden rendering them invisible for the user. However on errors the macro breaks and leaves the sheets visible to the user...
  3. M

    Error when looping on files

    Hello, I have a macro that does plotting on a group of files. But if the file has a particular word "[VERISION]" I need to skip it. I wrote the following that is within a loop for the files: ActiveSheet.Cells(1, 1).Select On Error GoTo GoodFile: Cells.Find(What:="[VERSION]"...
  4. L

    Problem with Calculation Manual and with On Error?

    Hello, dear MrExcel! After running code and before that i checked that excel is set to Auto calculation, excel turns calculation to manual? Before code is Application.Calculation = xlCalculationManual and at end is Application.Calculation = xlCalculationAutomatic. Also I have multiple On Error...
  5. C

    On error resting to default

    I have following code in one macro, initially on error it should skip it and go to next line For that I use on error resume next syntax but at some point I want to skip the entire Group or multiple lines and proceed from require line. So that I use On Error Goto Label syntax. This line is also...
  6. J

    VBA Ignoring On Error GoTo Command.. XL 2010

    Hi, Relatively new to VBA, but having read up on using On Error GoTo commands I cannot understand how the code is not responding when it encounters an error. The most annoying part is to get to that part of the code it has already correctly been navigated using an On Error statement. I'm sure...
  7. P

    How to go ahead with the error?

    If Err.Description = "No cells were found." Then Resume Next Else continue I know there is no Continue in excel. So what's the right keyword here? Thank You.
  8. T

    Error handling

    Good afternoon, I'm looking for a way to define an 'On error' statement that would just work for the line underneath the statement. With the statement below, I'm looking for a (week)number from 1 to 53. Weeknumber = InputBox("What week are you after") If the user would enter anything else I...
  9. M

    "On Error" Statement nested in for loop

    Hello, I'm new to VBA Programming, but my first program may be a little more complicated than I can handle. Here is a segment from my code: On Error GoTo Error_Handler For i = 2 To top With Range("I" & i + 57) .Formula = "=VLOOKUP(H" & i + 57 & ",F$59:G$" & top + 57 & ",2, FALSE)"...
  10. B

    VBA getting errors while using multiple On Error's in a macro

    I'm using multiple "ON ERROR" calls in a macro but I keep getting errors after the second iteration. I'm using the Cells.Find function when I get the error. Here's some of the code and the error I get: On Error GoTo NextOperation Do While Cells.Find(What:="cont'd", After:=ActiveCell...
  11. M

    VBA Add error handling to a loop

    My current code opens a file ("Report01.CSV") from the directories in column A (one at a time), and copies data into sheet 2. The problem is that sometimes there is no ("Report01.CSV") file in one or more of the directories. What I would like to add is an error handler that would remove the...
  12. C

    Error Handling in VBA

    Hello Below code is using the find method to search through a list and when an error occurs (find does not locate) it will copy over the missing information from one workbook to another. My issue is the first time the function does not find the value in the list it is not going to the error...
  13. sijpie

    Unexpected behaviour of 'On Error' 2nd time round

    Run the following code a few times, and then also supply a non existing sheet name. The second time you do that (does not have to be sequentially) the function fails, the on Error will not help out. Why is this happening? <font face=Courier New><SPAN style="color:#00007F">Sub</SPAN>...
  14. S

    On Error Resume Next

    I'm building a consolidation workbook that imports two worksheets from several different workbooks. One sheet is called "Summary", one is called "E-video." Every workbook has a "Summary" sheet, but not every workbook has an "E-video". My problem is that when I use On Error Resume Next (in...
  15. Johnny Thunder

    VBA Question - On Error Resume Next with Two Arguments - Excel 2010

    Hello All, I am working on a project that requires a user to push a macro button that will open a file specified in a drop down list. The file may be .XLS or a .XLSM and there would be no way for the user to know this so I need the code to look and see if it is a XLS and IF Not then Open the...
  16. R

    Error Handling

    Hi, I have some code with opens a file one at a time from a list and this works fine until the file in the list cannot be found in the already specified location. My only problem is what the code does when the file cannot be found. Currently, Excel displays a error message and then gives me...
  17. N

    VBA: MapPoint Macro Fails When More Than One Error

    I have the below code which looks at a list of postcodes that I have in my Excel (2003) sheet, plots them one by one on a MapPoint Map and then tells me the nearest Item to that postcode. It is worth mentioning that I have removed any pre-defined items, such as restaurants and train stations...
  18. B

    Create worksheet if worksheet does not exist

    Hi, I am new to the forum, but have been using it quite a lot to learn more about VBA. I am trying to write some code that will check a range of names within a worksheet and if there is a sheet with a name from the range excel should ignore it and move on to the next range. If no such worksheet...
  19. M

    On Error Help - Sub calling Private Subs

    Ok, I have never done anything with On Error before so please view me as a total newb in that regard. What I am trying to figure out is if I have a main Sub that is then calling a user form that then calls a private sub do I only need the On Error statement in the start Sub? Here is the basic...
  20. A

    On error goto

    how can i make in vba that if an error is in one line of a statement then skip to the third line and resume? i tried sevrel options but i get an error

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