Order Matic: May I take your order?

Similar documents
Create this Awesome Excel VBA Roster System with a Shift-Flow Generator

BASIC EXCEL SYLLABUS Section 1: Getting Started Section 2: Working with Worksheet Section 3: Administration Section 4: Data Handling & Manipulation

'... '... '... Module created: unknown '... Proj finished: March 21, 2012 '... '...

Lesson 4: Auditing and Additional Formulas. Return to the FastCourse Excel 2007 Level 3 book page

Microsoft Excel 2010 Basics

IF 1: 2: INDEX MATCH MATCH

Workbooks (File) and Worksheet Handling

Light Speed with Excel

The For Next and For Each Loops Explained for VBA & Excel

Excel Shortcuts Increasing YOUR Productivity

Basic tasks in Excel 2013

Top 15 Excel Tutorials

My Top 5 Formulas OutofhoursAdmin

Download the files from you will use these files to finish the following exercises.

Advanced Excel Charts : Tables : Pivots

Themes & Templates Applying a theme Customizing a theme Creatingfilefromtemplate Creating yourowncustomize Template Using templates Editing templates

The Item_Master_addin.xlam is an Excel add-in file used to provide additional features to assist during plan development.

Excel 2010 Macro Vba For Loop Through Rows In A Sheet

Excel Macro Record and VBA Editor. Presented by Wayne Wilmeth

Excel Tips. Contents. By Dick Evans

Microsoft Excel 2010 Level 1

Error Vba Code For Vlookup Function In Excel 2010

SBCUSD IT Training Program. MS Excel lll. VLOOKUPS, PivotTables, Macros, and More

Learning Map Excel 2007

Excel Basic 1 GETTING ACQUAINTED WITH THE ENVIRONMENT 2 INTEGRATION WITH OFFICE EDITING FILES 4 EDITING A WORKBOOK. 1.

Excel 2010 Tutorials - Video File Attributes

Microsoft Excel 2016 Level 1

Extracting the last word of a string Extracting all but the first word of a string Extracting first names, middle names, and last names Counting the

GO! with Microsoft Excel 2016 Comprehensive

Top 20 Excel Limitations that might Frustrate You!

Excel 2007 Tutorials - Video File Attributes

VBA Collections A Group of Similar Objects that Share Common Properties, Methods and

Microsoft Office Excel Create a worksheet group. A worksheet group. Tutorial 6 Working With Multiple Worksheets and Workbooks

DOING MORE WITH EXCEL: MICROSOFT OFFICE 2013

Excel Tutorials - File Size & Duration

3/31/2016. Spreadsheets. Spreadsheets. Spreadsheets and Data Management. Unit 3. Can be used to automatically

Creating If/Then/Else Routines

Troubleshooting and FAQs

For comprehensive certification training, students should complete Excel 2007: Basic, Intermediate, and Advanced. Course Introduction

Lastly, in case you don t already know this, and don t have Excel on your computers, you can get it for free through IT s website under software.

EVALUATION COPY. Unauthorized Reproduction or Distribution Prohibited EXCEL ADVANCED

Excel Format cells Number Percentage (.20 not 20) Special (Zip, Phone) Font

User Guide. Version 2.0. Excel Spreadsheet to AutoCAD drawing Utility. Supports AutoCAD 2000 through Supports Excel 97, 2000, XP, 2003, 2007

Customer details are included on a separate worksheet (Customer Look Up) Item details are included on a separate worksheet (Item Look Up)

Excel Tips for Compensation Practitioners Weeks Data Validation and Protection

MIS 0855 Data Science (Section 006) Fall 2017 In-Class Exercise (Day 18) Finding Bad Data in Excel

Ms Excel Vba Continue Loop Through Worksheets By Name

Never Give Up Page 1

If the list that you want to name will change In Excel 2007 and later, the easiest way to create.

SPREADSHEET (Excel 2007)

Ms Excel Vba Continue Loop Through Columns Range

KEYWORDS DDE GETOBJECT PATHNAME CLASS VB EDITOR WITHEVENTS HMI 1.0 TYPE LIBRARY HMI.TAG

DOWNLOAD PDF EXCEL MACRO TO PRINT WORKSHEET TO

EXCEL 2007 GETTING STARTED

Learning Microsoft Excel Module 1 Contents. Chapter 1: Introduction to Microsoft Excel

Corporate essentials

Safari ODBC on Microsoft 2010

Excel & Visual Basic for Applications (VBA)

Excel Level 1

HOW TO ACE THE 21 MOST COMMON QUESTIONS IN VBA 1

DOING MORE WITH EXCEL: MICROSOFT OFFICE 2010

Chapter 3: The IF Function and Table Lookup

Introduction... 3 Introduction... 4

2. This is a cell; this cell is designated as A1.

Reference Services Division Presents. Excel Introductory Course

The Microsoft Excel Course is divided into 4 levels

Excel Conditional Formatting (Mac)

Microsoft Excel > Shortcut Keys > Shortcuts

Assessed Exercise 1 Working with ranges

Designed by Jason Wagner, Course Web Programmer, Office of e-learning NOTE ABOUT CELL REFERENCES IN THIS DOCUMENT... 1

Unit 9 Spreadsheet development. Create a user form

Instructions on Adding Zeros to the Comtrade Data

All Excel Topics Page 1 of 11

download instant at

Microsoft Certified Application Specialist Exam Objectives Map

Ms Excel Vba Continue Loop Through Range Of

MICROSOFT EXCEL KEYBOARD SHORCUTS

Advanced Excel Macros : Data Validation/Analysis : OneDrive

CHAPTER 4: MICROSOFT OFFICE: EXCEL 2010

Excel Productivity Guide

TABLE OF CONTENTS. i Excel 2016 Advanced. 1 INTRODUCTION Method Software and other settings Exercise files 2

Explore commands on the ribbon Each ribbon tab has groups, and each group has a set of related commands.

Copyright & License Notes 3 Introduction 13 Chapter 1 - Excel Basics 14. Chapter 2 - Working with Data 32

How to Compare Two Lists or Columns in Excel

most of that the data into change the paste Rename the sheet this:

2. create the workbook file

1.a) Go to it should be accessible in all browsers

Learning Microsoft Excel Module 1 Contents. Chapter 1: Introduction to Microsoft Excel

Using Microsoft Excel

EXCEL 2003 DISCLAIMER:

Course Title: Intermediate Excel (Version :2013/2016) Duration : 2 days

DOWNLOAD PDF VBA MACRO TO PRINT MULTIPLE EXCEL SHEETS TO ONE

Creating Automated Dashboard Excel 2013 Contents

Introduction... 1 Part I: Getting Started with Excel VBA Programming Part II: How VBA Works with Excel... 31

The Foundation. Review in an instant

Copyright 2018 MakeUseOf. All Rights Reserved.

Intermediate Excel Training Course Content

EXCEL ADVANCED Linda Muchow

Microsoft Excel Expert 2010, Objective Domain

Identifying Updated Metadata and Images from a Content Provider

Transcription:

Order Matic: May I take your order? This is an awesome application. There is so much to learn here. This application will work in Microsoft Excel 2003 / 2007 / 2010 / 2013. I have had requests for an application like this when I released the Invoice Generator. Order-Matic: Order and Inventory Management in Excel will enable you to add your orders and instantly see if the stock exists to cover the order. It is designed for training purposes but could be modified to suit your individual needs. The key feature of this application is the ability to filter and view orders by any criteria or time. I have not included charting for the filtered results; this however this would be an easy aspect to include. Here are all of the worksheets in the template The 6 sheets are shown in this illustration describing their function. I have left the data in so that you will have something to work with as you proceed with the project. The calender is also included in the template. The template for order and inventory management (Order-Matic) is available for download below and all of the code will be included in the article. To help with the learning process I have added videos to show the steps involved. If you want to customize Oder-Matic to your needs may I suggest that you go through the tutorials and get this working as I have created it and then customize the project? You will have better success if you first understand how the application is pieced together. The possibilities for this application are greater than what I have used it for. Let me know the uses for which you adapt this program. What you will learn in Order - Matic Dynamic named ranges Static named ranges Making ranges dynamic with code Dependent data validation lists Conditional formatting

Protect and unprotect with code IF function Vlookup function Dealing with the N/A error Navigation with hyperlinks Sorting data without selecting Advanced Filters Watch this video for an overview of Order Matic Part 2 The filter sheet (Interface) We will use here the awesome advanced filter to filter our data. You will learn how to create your own Advanced Filter macro and show you how customize it to make it more effective. What makes this so special is the multiple criteria block that we are setting up to use with the Advanced filter. We will be able to filter by year by month by customer any criteria at all. Pay special attention to the formulas we used to create these effects. Watch this video for setting up the filtering for Order Matic Filtering / Navigation / Advanced Filter Macro http://www.youtube.com/watch?v=wa_gg9pvmvc Adding the navigation for the application Add a named range in cell A1 on each worksheet. To do this click into cell A1 and then type the name in the name box to the left of the formula bar and hit the Enter key. AllOrdersSheet OrderSheet ProductSheet StockSheet ClientSheet Interface =AllOrders!$A$1 =Order!$A$1 =Products!$A$1 =Stock!$A$1 =Customers!$A$1 =Interface!$A$1 Add 2 named ranges for the Months and for the Years Monthit Years =Interface!$X$4:$X$15 =Interface!$V$4:$V$8 Add a named range that we will use to clear all the data on the interface sheet

ClearFilters =Interface!$D$9:$L$1000,Interface!$E$5:$I$5 Here is some general information about static named ranges How to create named ranges tutorial To create a named range simply highlight the range or cell and then click in the name box just above column A. Type the name with no spaces and hit enter. Add a dynamic named range for the customers Here is a link to a tutorial for dynamic name ranges Customer_Key =OFFSET(Customers!$C$6,,,COUNTA(Customers!$C:$C)) Here is some general information about dynamic named ranges Dynamic named range tutorial Let s discuss Excel dynamic named ranges arguments one at a time. The first is a cell reference that is the starting cell for the range The second argument is the number of rows you wish to offset. By offset we mean just simply move to. For example if we wanted to start our range at F16 then the row number would be 1 if we wish to start a range at F14 then the road number would be -1. The third argument is the same as the second except that it refers to columns, if we wish to move one column to the right we would have the number 1 if we wish to move to the left we would add the number -1.

The fourth and fifth are optional arguments that you probably don t use regularly when using the offset function but it is these two optional arguments that make add dynamic named range possible because we will be replacing them with a formula that counts the number in a range. In the offset function if we wanted to refer to 15 rows then we would add the number 15. The fifth argument is the same as the fourth except that it refers to columns. Look at the example below Criteria for the advanced filter You will need to look closely at the formulas I am using to extract the data. Interface!$O$4 Interface!$P$4 Interface!$Q$4 Interface!$R$4 Interface!$S$4 Interface!$T$4 =IF(E5="","",">="&E5) =IF(E5="","","<="&E5+365) =IF(F5="",">0",VLOOKUP(F5,X4:Y15,2,0)) =IF(G5="","",G5) =IF(H5="","",H5) =IF(I5="","",I5) Check these carefully first. I have left them in the template to help to speed up the process. Running the advanced filter

Try recording the advanced filter and then make the modifications as shown below. This code goes into the Filter module. [box style="note"]sub Advanced() 'Unprotect_All Application.ScreenUpdating = False Set area = Sheet5.Range("C6:O1000000")' area.advancedfilter Action:=xlFilterCopy _, CriteriaRange:=Sheet1.Range("O3:T4"), CopyToRange:=Sheet1.Range("D8:L8"), _ Unique:=False Application.ScreenUpdating = True Sheet1.Select 'Protect_All [/box] We need to clear the data and this little piece of code will do just that. [box style="note"]sub Clearme() Application.ScreenUpdating = False With Sheet1.Range("a9:l1000").ClearContents.Range("E5:I5").ClearContents End With [/box] Assign the macros Right click on the Filter button and then on the Clear button and assign the respective macros. Test your application to see if it works with all criteria. Order Matic: May I take your order? Part 3

Entering Orders:- all of the Formulas This part of our project deals with all of the named ranges and the formulas that will use on our audit sheet. I ve made it easy to you to add these to your project with illustrations that show exactly where they should be included. Take the time to understand how the formulas work, exactly what they are doing. Then when you change your project to suit your own needs you ll be other customize these formulas very easily. Pay particular attention to the cascading data validation and the named ranges that are necessary for it to operate. Try to understand how it works so that you can customize it to your needs. Watch the video carefully and copy the steps to your own project. Watch this video for setting up the Order transfer sheet for Order Matic http://www.youtube.com/watch?v=-_uhsz3wxna We will now move our attention to the order sheet To add customer data validation use the dynamic named range Customer_Key from the previous section. Add this dynamic named ranges as shown below Customers =OFFSET(Customers!$C$6,,,COUNTA(Customers!$C:$C),6) Look up customers details =IF(ISNA(VLOOKUP($G$12,Costumers,2,0)),"",VLOOKUP($G$12,Costumers,2,0)) =IF(ISNA(VLOOKUP($G$12,Costumers,3,0)),"",VLOOKUP($G$12,Costumers,3,0)) =IF(ISNA(VLOOKUP($G$12,Costumers,4,0)),"",VLOOKUP($G$12,Costumers,4,0)) =IF(ISNA(VLOOKUP($G$12,Costumers,5,0)),"",VLOOKUP($G$12,Costumers,5,0)) =IF(ISNA(VLOOKUP($G$12,Costumers,6,0)),"",VLOOKUP($G$12,Costumers,6,0)) Cascading data validation (Dependent Lists)

Add a named range called Cascade =Products!$E$5 Add a temporary name range Category_Full =Products!$D$6:$D$35 Add a dynamic named range called Category =OFFSET(Products!$T$6,,,COUNTA(Products!$T$6:$T$58)) Add data validation to cell H19 and use the dynamic named range Category as its source. It is important that you sort the Products by Category on the Product sheet before adding the validation to the Order sheet. I would like to say that this is simple but it is not. This formula will take a bit of getting your head around. I will try to explain it the best I can. Add data validation for the description field I19 and put the formula below into the source field. The validation for the description field is a little more complex. =OFFSET(Cascade,MATCH($H19,Category_Full,0),0,COUNTIF(Category_Full,$H19),1) Here is how it works. Look at the breakdown of the offset function. OFFSET(reference,rows,cols,[Height],[Width]) Reference = is the static named range Cascade on the Orders worksheet.=offset(cascade, Row = Is the MATCH function matching the value in the from the dropdown box on the product sheet to the named range Category_Full =OFFSET(Cascade,MATCH($H19,Category_Full, Cols = 0. We are not referencing cols here. [Height] = This is a COUNTIF of the named range Category _Full that has the value from the dropdown box for the codes. [Width] = This is a column reference that moves 1 column to the right. Here is the completed formula for the validation list. =OFFSET(Cascade,MATCH($H19,Category_Full,0),0,COUNTIF(Category_Full,$H19),1) [box style="note"] In a nutshell Our dynamic range for the data validation starts on the Products sheet at E5(named range Cascade ). We find a ( MATCH) matches for the Category value on the product sheet named range Category_Full then we do a count(countif) for the same range to select the number and move one column to the right to select the description values. I guess that s not really a nutshell. Watch the gif below.

[/box] This is how the cascading validation should look The next step is to add the formulas to the works sheet Adding the formulas from left to right =MONTH(D19) =$N$13 =$O$13 =$G$12 =IF(ISNA(VLOOKUP($I19,Items,2,0)),"",VLOOKUP($I19,Items,2,0)) =IF(ISNA(VLOOKUP($I19,Items,3,0)),"",VLOOKUP($I19,Items,3,0)) =IF(K19="","",G19*K19) =IF(L19="","",IF(M19="",L19,L19-(L19*M19))) =IF(ISNA(VLOOKUP(J19,InStock,3,0)),"",VLOOKUP(J19,InStock,3,0)) =IF(OR(G19="",O19=""),"",IF(O19-G19>=1,"Sufficent Stock","Insufficient Stock"))

=IF(OR($N$13="",$G19=""),"",$N$13) =IF(J19="","",J19) =IF(G19="","",G19) Order Matic: May I take your order? Part 4 Watch this video for setting up the Order transfer sheet for Order Matic http://www.youtube.com/watch?v=hkjmksqv-pc The Order Sheet adding the VBA code In this section after we add a little bit of conditional formatting I m going to show you how to insert the formulas to total the information on the order sheet. In the majority of this tutorial will deal with adding the VBA code that transfers the information from the order sheet to the database and into our stock in an out sheet. All of this code is available on the website but I would suggest that you take the time to watch the video and understand how it all works and then added to your project. Please pay special attention to the two dynamic named ranges that we use in order to transfer the data. They are set up a little bit different to what you would expect. Conditional formatting On the Home tab choose Conditional formatting / Format only cells that contain/cell Value /equal to/= insufficient Stock. Add a second condition for Sufficient Stock. Then copy the formatting to all of the cells in the range. Formulas for the totals in the Orders sheet Here are the formulas for the top of the form.

These are the bottom formulas. Change the 109 for other functions. See illustration below. Make sure that you add these 2 dynamic named ranges. Pay close attention to how they are formulated. StockOut =OFFSET(Order!$Q$19,,,COUNTA(Order!$G$19:$G$49),3) Orders =OFFSET(Order!$G$19,,-4,COUNTA(Order!$G$19:$G$49),12) These 5 procedures need to be added to the Worksheet Orders Scroll to the top of the sheet on open Private Sub Worksheet_Activate() ActiveWindow.ScrollColumn = 1 ActiveWindow.ScrollRow = 1 Activate the calendar Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Target.Address = "$N$13" Then fcalendar.show

End If Clear the form Sub Clear_Order() Dim Clr As Range Set Clr = Sheet2.Range("ClearOrder") Clr.Value = "" Add the Spin button When you modify the application to suit your needs you will need to change the paremeters for the rows 49-19 and 19-49 to suit the needs of the application. 'Spin up macro for rows 49 to 19. Adjust this if you range increases or decreases. Private Sub S1_SpinUp() Dim i On Error GoTo errhandler: For i = 49 To 19 Step -1 If Cells(i, 1).EntireRow.Hidden = False Then Cells(i, 1).EntireRow.Hidden = True End If Next If Range("a19") = ActiveCell Then MsgBox "This is the end of the available range" errhandler: MsgBox "There appears to be an error please contact your administrator" 'Spin Down Macro for rows 19 to 49. Adjust this if you range increases or decreases. Private Sub S1_SpinDown() Dim i On Error GoTo errhandler: For i = 19 To 49 If Cells(i, 1).EntireRow.Hidden = True Then Cells(i, 1).EntireRow.Hidden = False End If Next If Range("a49") = ActiveCell Then MsgBox "This is the end of the available range" errhandler:

MsgBox "There appears to be an error please contact your administrator" These procedures are for the CopyTo module Sub Update() 'set named ranges Application.ScreenUpdating = False returnto = ActiveSheet.Name Sheet6.Activate With Sheet6 Sheet6.Range("F10:F" & Cells(Rows.Count, "F").End(xlUp).Row).Name = "StockOutCode" Sheet6.Range("G10:G" & Cells(Rows.Count, "G").End(xlUp).Row).Name = "StockOutQty" Sheet6.Range("K10:K" & Cells(Rows.Count, "K").End(xlUp).Row).Name = "StockInCode" Sheet6.Range("J10:J" & Cells(Rows.Count, "J").End(xlUp).Row).Name = "StockInQty" End With ThisWorkbook.Sheets(returnto).Select Sub Items() 'set named ranges Application.ScreenUpdating = False Sheet3.Activate With Sheet3.Range("E6:G" & Cells(Rows.Count, "G").End(xlUp).Row).Name = "Items".Range("C6:G" & Cells(Rows.Count, "G").End(xlUp).Row).Name = "FullItems".Range("T6:T" & Cells(Rows.Count, "T").End(xlUp).Row).Name = "Category".Range("D6:D" & Cells(Rows.Count, "D").End(xlUp).Row).Name = "Category_Full".Range("F6:I" & Cells(Rows.Count, "F").End(xlUp).Row).Name = "InStock".Range("FullItems").Sort Key1:=Sheet3.Range("D6"), Order1:=xlAscending, Header:=xlGuess End With Sheet3.Select Sub CopyCells() 'written by Trevor Easton 21/2/2013 'This code will pick up a range from multiple sheets and add the 'data to the next available range in sheet1 'error handler On Error GoTo Scooby_doo: 'unprotect all sheets 'Unprotect_All 'dim variables Dim DstRng As Range 'destination range

Dim SrcRng1 As Range 'sourse range 'destination variable Set DstRng = Sheet5.Range("d5") Set DstRng2 = Sheet6.Range("e9") Application.ScreenUpdating = False If Range("N13") = "" Then MsgBox "It appear that you have forgotten to add the date" ElseIf Range("O13") = "" Then MsgBox "The order number is missing" ElseIf Range("G12") = "" Then MsgBox "Please add the customer" Else 'give the user a chance to exit here Select Case MsgBox _ ("You are about to finalise this order." _ & vbcrlf & "Check everything before you proceed", _ vbyesno Or vbexclamation, "Are you sure?") Case vbyes Case vbno End Select 'copy and paste data without selecting 'first sheet 'sourse variable Set SrcRng1 = Sheet2.Range("Orders") SrcRng1.Copy DstRng.End(xlDown).Offset(1, 0).PasteSpecial xlpastevalues 'second sheet 'sourse variable Set SrcRng2 = Sheet2.Range("StockOut") SrcRng2.Copy DstRng2.End(xlDown).Offset(1, 0).PasteSpecial xlpastevalues 'empty clipboard Application.CutCopyMode = False 'confirmation message MsgBox "Your order has been sent to the order database" _ & vbcrlf & "and the totals have been sent to All Stock" 'clear the order Clear_Order ' Protect_All Sheet2.Select Application.ScreenUpdating = True Update End If 'error handler 'exit sub on error

Scooby_doo: 'message on error MsgBox " Opps a daisy, something has gone bottoms up" 'reprotect if error occurs 'Protect_All Order Matic: May I take your order? Part 5 This sheet contains the list of our products and contains the stock levels for each item that we stock. As stock comes in we can add it to the database from here. I have used condition formatting to show the levels and to highlight stock that falls below the desired level. This part on its own would make a great little application. Watch this video for setting up the Products sheet for Order Matic http://www.youtube.com/watch?v=0zkm7ptbyie Products and Inventory Stock Levels In stock Here are the formulas for calculating the stock levels. =IF($F6="","",SUMIF(StockOutCode,$F6,StockOutQty)) =IF($F6="","",SUMIF(StockInCode,$F6,StockInQty)-H6) =IF(I6="","",IF(I6<=0,"Out of Stock",IF(I6<=50,"Less then 50 Reorder Now","Stock Level is Fine"))) Add stock These formulas just look up the quantities from the stock sheet.

=IF(ISNA(VLOOKUP($H4,Items,2,0)),"",VLOOKUP($H4,Items,2,0)) =IF(ISNA(VLOOKUP($H4,Items,3,0)),"",VLOOKUP($H4,Items,3,0)) This just gives the total. The IF function is used to remove the error if either cell is empty. =IF(OR(E4="",I4=""),"",E4*I4) Conditional formatting Activate the calendar in cell D4 With the Edit Clicked 'Add this code to the sheet Products so that when it is double clicked the calendar will show. Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Target.Address = "$D$4" Then fcalendar.show End If Named range for the data that will be added. Name the range AddStockProduct =Products!$D$4:$F$4 Named range to clear the data

Name the range ClearstocP =Products!$D$4,Products!$E$4,Products!$G$4,Products!$H$4 Add the code to move the data to the stock sheet This macro is very similar to the CopyTo macro. The range to copy is a single range and the cells to check for content before proceeding are different. Here is the part that does the work. You will note we are sending the range that we just created across to In stock. [box style="note"]set DstRng = Sheet6.Range("I8") Set SrcRng1 = Sheet3.Range("AddStockProduct") SrcRng1.Copy DstRng.End(xlDown).Offset(1, 0).PasteSpecial xlpastevalues[/box] This is the complete code to be added to your project Sub Add_Stock_Products() 'written by Trevor Easton 21/2/2013 'This code will pick up a range from multiple sheets and add the 'data to the next available range in sheet1 'error handler On Error GoTo Scooby_doo: 'unprotect all sheets 'Unprotect_All 'dim variables Dim DstRng As Range 'destination range 'destination variable Set DstRng = Sheet6.Range("I8") Application.ScreenUpdating = False If Range("D4") = "" Then MsgBox "It appear that you have forgotten to add the date" ElseIf Range("E4") = "" Then MsgBox "The quantity is missing" ElseIf Range("H4") = "" Then MsgBox "Please add the Description" Else 'give the user a chance to exit here Select Case MsgBox _ ("You are about to add stock." _ & vbcrlf & "Check everything before you proceed", _

vbyesno Or vbexclamation, "Are you sure?") Case vbyes Case vbno End Select 'copy and paste data without selecting 'first sheet 'sourse variable Set SrcRng1 = Sheet3.Range("AddStockProduct") SrcRng1.Copy DstRng.End(xlDown).Offset(1, 0).PasteSpecial xlpastevalues 'empty clipboard Application.CutCopyMode = False 'confirmation message MsgBox "Your stock hase been has been added." _ & vbcrlf & "and the totals have been sent to In Stock" 'clear the product Sheet3.Range("ClearStocP").ClearContents ' Protect_All Sheet3.Select Application.ScreenUpdating = False Update End If 'error handler 'exit sub on error Scooby_doo: 'message on error MsgBox " Opps a daisy, something has gone bottoms up" 'reprotect if error occurs 'Protect_All Order Matic: May I take your order? Part 6 Watch this video to put the final touches on Order Matic http://www.youtube.com/watch?v=w595xw8d7ra The client sheet We already have our 2 dynamic named ranges working in here Customer and Customer_Full. So there is nothing to do but add new customers and they will automatically be used.

The AllOrders sheet There is nothing to change here. The stock sheet Here are the formulas =IF(ISNA(VLOOKUP($I6,Items,2,0)),"",VLOOKUP($I6,Items,2,0)) =IF(ISNA(VLOOKUP($I6,Items,3,0)),"",VLOOKUP($I6,Items,3,0)) =IF(OR(F6="",J6=""),"",F6*J6)

StockIn named range Add a named range StockIn =Stock!$E$6:$G$6 Clear Stock named range Add the named range "ClearStock" =Stock!$E$6,Stock!$F$6,Stock!$H$6,Stock!$I$6 Named range to clear the fields Nmae the range ClearStock =Stock!$E$6,Stock!$F$6,Stock!$H$6,Stock!$I$6 Code to add stock from the stock sheet This code is identical to Add_Stock_Products with just different parameters and named range. Here is the part of the code that does all of the work. [box style="note"] Set DstRng = Sheet6.Range("I8") Set SrcRng1 = Sheet6.Range("StockIn") SrcRng1.Copy DstRng.End(xlDown).Offset(1, 0).PasteSpecial xlpastevalues[/box] Sub Add_Stock() 'written by Trevor Easton 21/2/2013 'This code will pick up a range from multiple sheets and add the 'data to the next available range in sheet1 'error handler On Error GoTo Scooby_doo: 'unprotect all sheets 'Unprotect_All 'dim variables Dim DstRng As Range 'destination range

'destination variable Set DstRng = Sheet6.Range("I8") Application.ScreenUpdating = False If Range("E6") = "" Then MsgBox "It appear that you have forgotten to add the date" ElseIf Range("F6") = "" Then MsgBox "The quantity is missing" ElseIf Range("I6") = "" Then MsgBox "Please add the description" Else 'give the user a chance to exit here Select Case MsgBox _ ("You are about to add stock." _ & vbcrlf & "Check everything before you proceed", _ vbyesno Or vbexclamation, "Are you sure?") Case vbyes Case vbno End Select 'copy and paste data without selecting 'first sheet 'sourse variable Set SrcRng1 = Sheet6.Range("StockIn") SrcRng1.Copy DstRng.End(xlDown).Offset(1, 0).PasteSpecial xlpastevalues 'empty clipboard Application.CutCopyMode = False 'confirmation message MsgBox "Your stock hase been has been added." _ & vbcrlf & "and the totals have been sent to InStock" 'clear the stock Sheet6.Range("ClearStock").ClearContents ' Protect_All Sheet6.Select Application.ScreenUpdating = True Update End If 'error handler 'exit sub on error Scooby_doo: 'message on error

MsgBox " Opps a daisy, something has gone bottoms up" 'reprotect if error occurs 'Protect_All Protect your work After adding this code you will need to go back through all of the modules and uncomment Protect_All and UnProtect_All. It is absolutely necessarily that you do this in the This Workbook module as we need the UserInterfaceOnly:=True to run when the workbook opens. This is the code for the protect and unprotect module Protect code Sub Protect_All() Dim ws As Worksheet For Each ws In ActiveWorkbook.Worksheets ws.protect Password:="Online", DrawingObjects:=True, Contents:=True, Scenarios:=True _, AllowFormattingCells:=True, AllowFormattingColumns:=True, AllowFormattingRows:=True, AllowSorting:=True, UserInterfaceOnly:=True ActiveSheet.EnableSelection = xlunlockedcells Next ws Unprotect code Sub Unprotect_All() Dim i On Error Resume Next Application.ScreenUpdating = False Application.EnableEvents = False For i = 1 To Sheets.Count Sheets(i).Unprotect Password:="Online" Next i Application.ScreenUpdating = True Application.EnableEvents = True On Error GoTo 0