error handling

  1. E

    VBA error saving a new sheet. "That name is already taken"

    I'm trying to run a macro that will copy and save the sheet with today's date in its worksheet name. It will work perfectly fine when I run this macro once a day, but it will give back an error when I run it a second time during the same day because I don't have any error handling in it...
  2. tourless

    A better way to handle blanks

    Hi Folks. I have a routine that is supposed to look for blank cells (after there is a subtotal placed on the data) and fill them with data. My problem is sometimes there is only one subtotal so that leaves the 'filling in the blanks' problem mute. My routine doesn't know how to handle that...
  3. B

    How To Omit Specific Worksheets From ActiveX Combo Box List

    I have managed to wangle together this VBA code to select & print preview certain worksheets from the workbook. It works great, but I want to exclude certain sheets from the list. I am hoping some VBA guru here can help me out please? Sub Print_Sheets() Dim i As Long, c As Long Dim...
  4. WildBurrow

    Worksheet Change ByVal Target As Range triggers once then stops

    I've noticed that my code will run correctly with the first select; however, if the User goes back and changes the cell value the code will not run. Basically, they may "toggle" back and forth with their answers. When I place the Application.EnableEvents=True in the immediate window, things...
  5. 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...
  6. 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) &...
  7. 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...
  8. 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...
  9. 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.
  10. 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...
  11. 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...
  12. 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...
  13. 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...
  14. 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...
  15. 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...
  16. 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:=...
  17. 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 =...
  18. 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 =...
  19. 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...
  20. 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...

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