So.... I have an UpdateButton Macro assigned to my P.O. Generator, and want it to stop and ensure all fields are filled out prior to update. - Sub UpdateButton()
-
Application.ScreenUpdating = False
-
Dim copySheet As Worksheet
-
Dim pasteSheet As Worksheet
-
-
Set copySheet = Worksheets("Purchase Order")
-
Set pasteSheet = Worksheets("PO Log")
-
-
copySheet.Range("POnumber").Copy
-
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("OrderSummary").Copy
-
pasteSheet.Cells(Rows.Count, 2).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("POdate").Copy
-
pasteSheet.Cells(Rows.Count, 3).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("RequestedBy").Copy
-
pasteSheet.Cells(Rows.Count, 4).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("Vendor").Copy
-
pasteSheet.Cells(Rows.Count, 5).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("DeliveryDate").Copy
-
pasteSheet.Cells(Rows.Count, 6).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("Cost").Copy
-
pasteSheet.Cells(Rows.Count, 7).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
Range("='Purchase Order'!$B$2:$N$47").PrintOut
-
-
End Sub
-
For all that are interested.... The solution to my issue was -
-
If IsEmpty(Range("OrderSummary")) Or IsEmpty(Range("RequestedBy")) Or IsEmpty(Range("POnumber")) Then
-
MsgBox "Information is Missing:Requested By, Order Summary, and P.O. Require User Input", vbRetryCancel
-
Exit Sub
-
End If
That is all...
2 1482
Okay... So I think I have figured part of it out with - If Cells(4, 3).Value = "" Then
-
MsgBox "Requested By Requires User Input"
-
-
Cancel = True
-
End If
But I would like this add-on to stop the updating process as well... HELP!!
Here's entire code with new MsgBox code. - Sub UpdateButton()
-
Application.ScreenUpdating = False
-
Dim copySheet As Worksheet
-
Dim pasteSheet As Worksheet
-
-
Set copySheet = Worksheets("Purchase Order")
-
Set pasteSheet = Worksheets("PO Log")
-
-
copySheet.Range("POnumber").Copy
-
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("OrderSummary").Copy
-
pasteSheet.Cells(Rows.Count, 2).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("POdate").Copy
-
pasteSheet.Cells(Rows.Count, 3).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("RequestedBy").Copy
-
pasteSheet.Cells(Rows.Count, 4).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("Vendor").Copy
-
pasteSheet.Cells(Rows.Count, 5).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("DeliveryDate").Copy
-
pasteSheet.Cells(Rows.Count, 6).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = True
-
-
copySheet.Range("Cost").Copy
-
pasteSheet.Cells(Rows.Count, 7).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
-
Application.CutCopyMode = False
-
Application.ScreenUpdating = Tru
-
-
If Cells(4, 3).Value = "" Then
-
MsgBox "Requested By Requires User Input"
-
-
Cancel = True
-
End If
-
-
Range("='Purchase Order'!$B$2:$N$47").PrintOut
-
-
End Sub
For all that are interested.... The solution to my issue was -
-
If IsEmpty(Range("OrderSummary")) Or IsEmpty(Range("RequestedBy")) Or IsEmpty(Range("POnumber")) Then
-
MsgBox "Information is Missing:Requested By, Order Summary, and P.O. Require User Input", vbRetryCancel
-
Exit Sub
-
End If
That is all...
Sign in to post your reply or Sign up for a free account.
Similar topics
by: David Colliver |
last post by:
Hi all,
I am having a slight problem that hopefully, someone can help me fix.
I have a form on a page. Many items on the form have validation controls
attached.
Also on this form are...
|
by: J055 |
last post by:
Hi
I have 2 update buttons in my FormView ('Apply' and 'OK'). I want both
buttons to update the data source but the 'OK' button should redirect
afterwards.
I can see which button is clicked...
|
by: ayneekeaw |
last post by:
When I click the update button/link at the Gridview to update the data from drop down list into the SQL. The selected value of drop down list change to default value. How can I fix this problem
|
by: mesut |
last post by:
Hi there,
I've a question. I would like to create a global update button to
update all changed records gridview.
e.g. A gridview contains 5 columns an 2 of the columns can be updated
by the...
|
by: schuiazza |
last post by:
Hi,
I am updating a webpage which displays information about electrical networks.
The company requires to update gridstation information regarding voltage based on each are i..e south east etc,...
|
by: geeteshss |
last post by:
Dear all,
actually i spent a whole month on the R&D of datagrid edit ,update,cancel events but recently my guide told me to make it user friendly because no user would like to go on searching rows...
|
by: stimul8d |
last post by:
Before i get flamed, this isn't the usual question you see left right and center.
I'm dynamically creating usercontrols inside the page_init event and setting the ID's of each control so that the...
|
by: shekharncst |
last post by:
Hi I am using GridView in ASPX page
<asp:GridView AutoGenerateEditButton ="false" id="siGridView" runat="server"
Font-Names="Cordia New" Font-Size="Smaller"
...
|
by: Cad33ee |
last post by:
Good Day!
I Am using Microsoft Access 2016. I would like to know how can i create a simple update button. I already created add, clear and close. However, I do have a hard time on creating an...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |