error handling

  1. V

    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...
  2. 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.
  3. 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...
  4. 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...
  5. 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...
  6. 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...
  7. 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...
  8. 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...
  9. 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:=...
  10. 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 =...
  11. 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 =...
  12. 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...
  13. 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...
  14. 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...
  15. 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...
  16. 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...
  17. 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...
  18. P

    VBA - If error carry on

    Hi, I have the following code which moves files from one location to another.. If a file doesn't exist, I would the code to carry on to the next file rather give an error message "File does not exist" appreciate any guidance you can give. Sub everythingexcCRO() Kill...
  19. J

    Compare Slicer Text Values to List

    Hi All, I need a code to put at the beginning of a macro that will compare slicer values (they are text) to a list of text values in another worksheet (call it worksheet1). Basically, if the slicer value cannot be found in the list, I want the macro to kill the routine so I do not get a run...
  20. J

    Handling errors in VBA calculations

    Hello I would like some advice. On one of my sub I have over 25 different calculations in VBA that get used to create a value. I am having problems where if one of the calculations is divided by zero then I get an error message. At the moment I am using the on error resume next. But this does...

Some videos you may like

This Week's Hot Topics

Top