gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,341
- Office Version
- 365
- Platform
- Windows
I use this on Error a lot, but have to admit I am not sure how it actually works.
On Error Resume Next
On Error GoTo 0
I have this code that will error on "With this Workbook - Sheets("Bid Years"..... Which I understand why. I am using Power Query and if certain data isnt available or the user didnt enter some data, the query will not run. Its really not an issue because it comes down to it being a user error more so than coding.
But what I would like to do is if this code does error I want to stop the code and have a msgbox pop up (You do not have the proper data entered for this proposal. Top Lever Assemblies, PBoMs may not have been input into ProPricer. Please enter the correct data or see the applicable Material Estimator.)
How do I do this? Thanks for the Help.
Thank You!
On Error Resume Next
On Error GoTo 0
I have this code that will error on "With this Workbook - Sheets("Bid Years"..... Which I understand why. I am using Power Query and if certain data isnt available or the user didnt enter some data, the query will not run. Its really not an issue because it comes down to it being a user error more so than coding.
But what I would like to do is if this code does error I want to stop the code and have a msgbox pop up (You do not have the proper data entered for this proposal. Top Lever Assemblies, PBoMs may not have been input into ProPricer. Please enter the correct data or see the applicable Material Estimator.)
How do I do this? Thanks for the Help.
Code:
Private Sub CommandButton1_Click()
'Get input from ListBox
ListBoxValue = ListBox1.Text
'Store input in the worksheet
Sheets("Step 1").Range("B11").Value = ListBoxValue
With ThisWorkbook
Sheets("Bid Assemblies").ListObjects(1).QueryTable.Refresh BackgroundQuery:=False
End With
With ThisWorkbook
Sheets("Bid Years").ListObjects(1).QueryTable.Refresh BackgroundQuery:=False
End With
With ThisWorkbook
Sheets("PBoM by Task").ListObjects(1).QueryTable.Refresh BackgroundQuery:=False
End With
With ThisWorkbook
Sheets("Costed PBoMs").ListObjects(1).QueryTable.Refresh BackgroundQuery:=False
End With
With ThisWorkbook
Sheets("Consolidated Parts").ListObjects(1).QueryTable.Refresh BackgroundQuery:=False
End With
Range("Table8[Proposal]").Select
ActiveCell.FormulaR1C1 = _
"=IFNA((XLOOKUP([@[Proposal Id]],'Proposal List'!C[1],'Proposal List'!C[-2])),"""")"
Range("Table8[Version]").Select
ActiveCell.FormulaR1C1 = _
"=IFNA((XLOOKUP([@[Proposal Id]],'Proposal List'!C,'Proposal List'!C[-2])),"""")"
UserForm1.Hide
Sheets("Step 1").Select
Range("B11").Select
End Sub
Thank You!