error handling

  1. J

    Workbook.Save "Upload Failed" Due to Edit Locked File on SharePoint - Not Producing Error

    Hi, I am trying to establish error handling for when a SharePoint-based network file won't save properly due to it being locked for editing by another user. When this happens, I simply want network users to get a message box indicating that the data wasn't saved. They can then request the...
  2. J

    How to check if power query is valid from VBA

    Hello, how to check if PQ is valid via VBA code? Cross posted here: How to check if power query is valid You can take example files from link. I am creating PQ formula and query via VBA code: Sub Macro1() ActiveWorkbook.Queries.Add Name:="Table1", Formula:= _ "let" & Chr(13) &...
  3. H

    Vlookup VBA code error handling

    i have a code that vlookups an ID number and brings in a name from a different sheet. However some of the rows are blank, as in no ID number - or they have two IDs in one cell How do i insert an error handing code to skip blank rows or unrecognised values? this is my current code. Sub...
  4. VBE313

    adding error handling to UDF

    How can i better write this code and add error handling? Function TotalStainless(EasyorHard As Double, Thickness As Double, NumOfPierces As Double, HoleCutLength As Double, TotalPerimeter As Double) Dim PierceSecs As Double Dim HolesInchPerMin As Double Dim PerimInchPerMin As Double...
  5. M

    Possible to check if user is on a MAC using ActiveX or Scripting.Dictionaries ?

    I would like to know if creating these two objects while on a MAC would create an error that can be used to adjust the workbook accordingly. Thank you for your time.
  6. M

    GoTo Error Handling Not Working

    I am trying to copy a table from Excel and paste as an image to PowerPoint. For some reason, the copy/paste methods error out about 1 in 10 attempts to run the code. :confused: I added GoTo error handling but the code seems to be ignoring it. On the line...
  7. D

    Writing txt. logs during a loop

    Need the following code to produce a txt. log on an error, but return the loop interger it was using when the error occured, then retunr to the loop. Sub email() Dim OutApp As Object, OutMail As Object Dim strbody As String Dim cell As Range Set cell = Range("J1") For i = 1 To cell.Value...
  8. S

    Error Handling for the mkdir command

    Hi, I have written some code which saves down a particular sheet of my excel workbook in excel and PDF form. I use the mkdir to create a new directory for the files to be saved in - however I need to insert some error handling into my code so that if I have already run the code and created the...
  9. G

    Error Handling in locked code

    I am creating workbook containing VBA procedures which will be distributed to many users on different sites. I have password protected the code to prevent people seeing/altering/stealing it but this is causing me problems supporting the workbook. I have covered foreseeable errors with...
  10. 3

    Error Handling - Import CSV file

    Hi, I have an excel where each time after the user bring it up, he or she would click in a button that call the procedure refresh(). Sub refresh() ThisWorkbook.RefreshAll Call timer End Sub Sub timer() Application.OnTime Now + TimeValue("00:10:00"), "refresh" End Sub On the...
  11. Rymare

    Subscript out of Range Error

    I keep getting a subscript out of range error when I run this code Private Sub CommandButton1_Click() Dim file_path As String Dim xlApp As Excel.Application Set xlApp = CreateObject("Excel.Application") file_path = FileSelectBox("*.xlsx") xlApp.Visible = True 'xlApp.Workbooks.Open...
  12. F

    VBA not working for MAC

    Hi All I am having an issue where i have a line for a macro which works for PC but not on mac. The lines provided i'm pretty sure are causing the issue: Set LookUpDate = ActiveCell On Error GoTo DateNotFound1 Rows(ActiveCell.Row).Cells.Find(What:=LookUpDate, After:=ActiveCell, LookIn:=...
  13. I

    Error issues

    Hi Guys, I'm trying to include error handling in the VBA below. So basically if the file (Workbooks("Pmet_Activity.csv")) doesn't exist, i'd like it to continue running ws(1). Thanks in advance! Sub BNPAll() Dim wbMO1 As Workbook, wbMO2 As Workbook Set wbMO1 =...
  14. L

    VBA - VLOOKUP in FOR loop, error handling issue

    Hei. I have this code and can't crack why I get Run-time error '1004': Unable to get the VLookup property of the WorksheetFunction class Any ideas? Private Sub Worksheet_Change(ByVal Target As Range) ... 'some other working code If (Target.Column = 13 Or Target.Column = 14 Or Target.Column =...
  15. O

    Creating Directories from data in selected cell and then create a sub-directory, one Macro

    I am trying to create a Macro in VBA editor. What I want it to do is create a directory from the text in one cell be selected. The code below works to create the directory from a selected cell but will not create sub-directory called "High". I also think I need some error handling...
  16. C

    error handling if user chooses wrong file in prompt based on predefined worksheets

    I have VBA code that prompts a user to select the workbook from a location. I want to add error handling so that if they choose an incorrect file based on the worksheets then apply a message box "wrong file" and re-enable the prompt to choose a new file. As you can see below I've already set...
  17. T

    Handling Errors from Match , stored in a variable.

    I have looked long for this, but i havent found a truly similar post on web in 2 hours. (so now im posting it on 3 forums) Scenario: dim Result as variant Result = Application.Match(string, Wb.Sheets("UD_Base").Range("UD_Base[U_ID]"), 0) --- Now if i check the values of -Result- it...
  18. D

    VBA - If file Path does not exist try another file path.

    Hi, I'm trying to write some code that will check if a file path exists = if yes continue macro, = if no try an alternative file path = if yes continue macro = if no exit with error msg. Basically my organisation has a strange network structure. For c90% of users the file path for the...
  19. C

    Error handling if worksheet does not exist

    Hi, I have built a macro that asks a user to input a development name into an input box. Then the code searches to see if there is a sheet with the name the user enters and deletes that worksheet. It then also removes a range of data on the summary sheet. The code I have so far is as...
  20. M

    Error handling that captures name and path details in a log without ending the macro

    I've developed a macro that crawls through a directory (every folder, sub-folder, sub-sub-folder etc), and deletes personal data from any Excel file that it finds - and this works well, so long as I ignore any errors along the way. What I would really like is for some form of error handling...
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

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
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 "".
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