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:
ActiveWorkbook.Queries.Add Name:="Table1", Formula:= _
"let" & Chr(13) &...
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.
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...
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...
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.
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...
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...
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...
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().
Application.OnTime Now + TimeValue("00:10:00"), "refresh"
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
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:=...
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!
Dim wbMO1 As Workbook, wbMO2 As Workbook
Set wbMO1 =...
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
Private Sub Worksheet_Change(ByVal Target As Range)
... 'some other working code
If (Target.Column = 13 Or Target.Column = 14 Or Target.Column =...
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...
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...
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)
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...
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...
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...
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...
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.