VBA - Procedure too large!

colinmel

New Member
Joined
Jul 15, 2009
Messages
32
<TABLE style="WIDTH: 248pt; BORDER-COLLAPSE: collapse" cellSpacing=0 cellPadding=0 width=328 border=0 x:str><COLGROUP><COL style="WIDTH: 31pt; mso-width-source: userset; mso-width-alt: 1499" span=8 width=41><TBODY><TR style="HEIGHT: 12.75pt" height=17><TD class=xl24 style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; WIDTH: 248pt; BORDER-BOTTOM: #ece9d8; HEIGHT: 25.5pt; BACKGROUND-COLOR: transparent" width=328 colSpan=8 height=34 rowSpan=2>I ran my Macro, which is quite long, and got the error message "PROCEDURE TOO LARGE"

Is there any way to split the VBA into 2 so that it runs?
</TD></TR><TR style="HEIGHT: 12.75pt" height=17></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; HEIGHT: 12.75pt; BACKGROUND-COLOR: transparent" height=17></TD><TD style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent"></TD><TD style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent"></TD><TD style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent"></TD><TD style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent"></TD><TD style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent"></TD><TD style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent"></TD><TD style="BORDER-RIGHT: #ece9d8; BORDER-TOP: #ece9d8; BORDER-LEFT: #ece9d8; BORDER-BOTTOM: #ece9d8; BACKGROUND-COLOR: transparent"></TD></TR></TBODY></TABLE>
 
I'm having the same problem but the code used to be longer and I did not have this problem. I can split it up into different codes but I would rather not. One site says that the max six is 64kb. How do I find out how large the function is? Is it the subroutine that's too large or the function?
 
Upvote 0

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
No you can't do that.

What you should do is go through the code and try and tidy it up.

Hi i have this issue with Excel 2016 64Bit the file is 63Kb please help

I have removed most green text

Private Sub CommandButton1_Click()


'Define the vairiables


Dim ENTRY_NUMBER As String
Dim TRIP_SHEET_NUMBER As String
Dim Line1Nett As Long
Dim Line2Nett As Long
Dim Line3Nett As Long
Dim Line4Nett As Long
Dim Line5Nett As Long
Dim Line6Nett As Long
Dim Line7Nett As Long
Dim Line8Nett As Long
Dim Line9Nett As Long
Dim Line10Nett As Long


Dim SALESINV1 As Long
Dim SALESINV2 As Long
Dim SALESINV3 As Long
Dim SALESINV4 As Long
Dim SALESINV5 As Long
Dim SALESINV6 As Long
Dim SALESINV7 As Long
Dim SALESINV8 As Long
Dim SALESINV9 As Long
Dim SALESINV10 As Long
Dim Cost As Long


Dim TRADEINV1 As Long
Dim TRADEINV2 As Long
Dim TRADEINV3 As Long
Dim TRADEINV4 As Long
Dim TRADEINV5 As Long
Dim TRADEINV6 As Long
Dim TRADEINV7 As Long
Dim TRADEINV8 As Long
Dim TRADEINV9 As Long
Dim TRADEINV10 As Long


Dim CostNett1 As Long
Dim CostNett2 As Long
Dim CostNett3 As Long
Dim CostNett4 As Long
Dim CostNett5 As Long
Dim CostNett6 As Long
Dim CostNett7 As Long
Dim CostNett8 As Long
Dim CostNett9 As Long
Dim CostNett10 As Long


Range("C4").Value = (Range("C4").Value + 1) 'add value to Trip Mumber
Sheets("SUMMARY").Select
Range("C8").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveCell.Offset(0, -2).Select
ENTRY_NUMBER = ActiveCell.Value


TRIP_SHEET_NUMBER = Range("D4").Value


ActiveCell.Offset(0, 2).Select
ActiveCell.Value = "DEPOT"
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = "LPG"
ActiveCell.Offset(0, 4).Select
ActiveCell.Value = Range("G4").Value


ActiveCell.Offset(0, 4).Select 'Driver
ActiveCell.Value = ComboBox1.Value
ActiveCell.Offset(0, 2).Select 'Vehicle
ActiveCell.Value = ComboBox2.Value
ActiveCell.Offset(0, 1).Select 'Trailer
ActiveCell.Value = ComboBox3.Value


ActiveCell.Offset(0, 1).Select 'Line1 Customer
ActiveCell.Value = ComboBox4.Value
ActiveCell.Offset(0, 1).Select 'Line1 Address
ActiveCell.Value = TextBox1.Value
ActiveCell.Offset(0, 1).Select 'Line1 Order Number
ActiveCell.Value = TextBox2.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 9KG
ActiveCell.Value = TextBox4.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 19G
ActiveCell.Value = TextBox5.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 48KG
ActiveCell.Value = TextBox6.Value


ActiveCell.Offset(0, 1).Select
ActiveCell.Value = (TextBox4.Value * 9) + (TextBox5.Value * 19) + (TextBox6.Value * 48) 'Line1 Nett weight
Line1Nett = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox61.Value 'Line1 KMS
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox3.Value 'Invoice Number


'2


ActiveCell.Offset(0, 2).Select 'Line2 Customer
ActiveCell.Value = ComboBox5.Value
ActiveCell.Offset(0, 1).Select 'Line2 Address
ActiveCell.Value = TextBox7.Value
ActiveCell.Offset(0, 1).Select 'Line2 Order Number
ActiveCell.Value = TextBox8.Value
ActiveCell.Offset(0, 1).Select 'Line2 QTY 9KG
ActiveCell.Value = TextBox10.Value
ActiveCell.Offset(0, 1).Select 'Line2 QTY 19G
ActiveCell.Value = TextBox11.Value
ActiveCell.Offset(0, 1).Select 'Line2 QTY 48KG
ActiveCell.Value = TextBox12.Value


ActiveCell.Offset(0, 1).Select
ActiveCell.Value = (TextBox10.Value * 9) + (TextBox11.Value * 19) + (TextBox12.Value * 48) 'Line1 Nett weight
Line2Nett = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox62.Value 'Line2 KMS
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox9.Value 'Line2 Invoice Number


'3


ActiveCell.Offset(0, 2).Select 'Line1 Customer
ActiveCell.Value = ComboBox6.Value
ActiveCell.Offset(0, 1).Select 'Line1 Address
ActiveCell.Value = TextBox13.Value
ActiveCell.Offset(0, 1).Select 'Line1 Order Number
ActiveCell.Value = TextBox14.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 9KG
ActiveCell.Value = TextBox16.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 19G
ActiveCell.Value = TextBox17.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 48KG
ActiveCell.Value = TextBox18.Value


ActiveCell.Offset(0, 1).Select
ActiveCell.Value = (TextBox16.Value * 9) + (TextBox17.Value * 19) + (TextBox18.Value * 48) 'Line1 Nett weight
Line3Nett = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox63.Value 'Line1 KMS
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox15.Value 'Invoice Number


'4


ActiveCell.Offset(0, 2).Select 'Line1 Customer
ActiveCell.Value = ComboBox7.Value
ActiveCell.Offset(0, 1).Select 'Line1 Address
ActiveCell.Value = TextBox19.Value
ActiveCell.Offset(0, 1).Select 'Line1 Order Number
ActiveCell.Value = TextBox20.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 9KG
ActiveCell.Value = TextBox22.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 19G
ActiveCell.Value = TextBox23.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 48KG
ActiveCell.Value = TextBox24.Value


ActiveCell.Offset(0, 1).Select
ActiveCell.Value = (TextBox22.Value * 9) + (TextBox23.Value * 19) + (TextBox24.Value * 48) 'Line1 Nett weight
Line4Nett = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox64.Value 'Line1 KMS
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox21.Value 'Invoice Number


'5


ActiveCell.Offset(0, 2).Select 'Line1 Customer
ActiveCell.Value = ComboBox8.Value
ActiveCell.Offset(0, 1).Select 'Line1 Address
ActiveCell.Value = TextBox25.Value
ActiveCell.Offset(0, 1).Select 'Line1 Order Number
ActiveCell.Value = TextBox26.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 9KG
ActiveCell.Value = TextBox28.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 19G
ActiveCell.Value = TextBox29.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 48KG
ActiveCell.Value = TextBox30.Value


ActiveCell.Offset(0, 1).Select
ActiveCell.Value = (TextBox28.Value * 9) + (TextBox29.Value * 19) + (TextBox30.Value * 48) 'Line1 Nett weight
Line5Nett = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox65.Value 'Line1 KMS
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox27.Value 'Invoice Number


'6


ActiveCell.Offset(0, 2).Select 'Line1 Customer
ActiveCell.Value = ComboBox9.Value
ActiveCell.Offset(0, 1).Select 'Line1 Address
ActiveCell.Value = TextBox31.Value
ActiveCell.Offset(0, 1).Select 'Line1 Order Number
ActiveCell.Value = TextBox32.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 9KG
ActiveCell.Value = TextBox34.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 19G
ActiveCell.Value = TextBox35.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 48KG
ActiveCell.Value = TextBox36.Value


ActiveCell.Offset(0, 1).Select
ActiveCell.Value = (TextBox34.Value * 9) + (TextBox35.Value * 19) + (TextBox36.Value * 48) 'Line1 Nett weight
Line6Nett = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox66.Value 'Line1 KMS
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox33.Value 'Invoice Number


'7


ActiveCell.Offset(0, 2).Select 'Line1 Customer
ActiveCell.Value = ComboBox10.Value
ActiveCell.Offset(0, 1).Select 'Line1 Address
ActiveCell.Value = TextBox37.Value
ActiveCell.Offset(0, 1).Select 'Line1 Order Number
ActiveCell.Value = TextBox38.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 9KG
ActiveCell.Value = TextBox40.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 19G
ActiveCell.Value = TextBox41.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 48KG
ActiveCell.Value = TextBox42.Value


ActiveCell.Offset(0, 1).Select
ActiveCell.Value = (TextBox40.Value * 9) + (TextBox41.Value * 19) + (TextBox42.Value * 48) 'Line1 Nett weight
Line7Nett = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox67.Value 'Line1 KMS
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox39.Value 'Invoice Number


'8


ActiveCell.Offset(0, 2).Select 'Line1 Customer
ActiveCell.Value = ComboBox11.Value
ActiveCell.Offset(0, 1).Select 'Line1 Address
ActiveCell.Value = TextBox43.Value
ActiveCell.Offset(0, 1).Select 'Line1 Order Number
ActiveCell.Value = TextBox44.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 9KG
ActiveCell.Value = TextBox46.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 19G
ActiveCell.Value = TextBox47.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 48KG
ActiveCell.Value = TextBox48.Value


ActiveCell.Offset(0, 1).Select
ActiveCell.Value = (TextBox46.Value * 9) + (TextBox47.Value * 19) + (TextBox48.Value * 48) 'Line1 Nett weight
Line8Nett = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox68.Value 'Line1 KMS
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox45.Value 'Invoice Number


'9


ActiveCell.Offset(0, 2).Select 'Line1 Customer
ActiveCell.Value = ComboBox12.Value
ActiveCell.Offset(0, 1).Select 'Line1 Address
ActiveCell.Value = TextBox49.Value
ActiveCell.Offset(0, 1).Select 'Line1 Order Number
ActiveCell.Value = TextBox50.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 9KG
ActiveCell.Value = TextBox52.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 19G
ActiveCell.Value = TextBox53.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 48KG
ActiveCell.Value = TextBox54.Value


ActiveCell.Offset(0, 1).Select
ActiveCell.Value = (TextBox52.Value * 9) + (TextBox53.Value * 19) + (TextBox54.Value * 48) 'Line1 Nett weight
Line9Nett = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox69.Value 'Line1 KMS
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox51.Value 'Invoice Number


'10


ActiveCell.Offset(0, 2).Select 'Line1 Customer
ActiveCell.Value = ComboBox13.Value
ActiveCell.Offset(0, 1).Select 'Line1 Address
ActiveCell.Value = TextBox55.Value
ActiveCell.Offset(0, 1).Select 'Line1 Order Number
ActiveCell.Value = TextBox56.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 9KG
ActiveCell.Value = TextBox58.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 19G
ActiveCell.Value = TextBox59.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 48KG
ActiveCell.Value = TextBox60.Value


ActiveCell.Offset(0, 1).Select
ActiveCell.Value = (TextBox58.Value * 9) + (TextBox59.Value * 19) + (TextBox60.Value * 48) 'Line1 Nett weight
Line10Nett = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox70.Value 'Line1 KMS
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox57.Value 'Invoice Number




Sheets("TRIP SHEET").Select


Range("C10").Value = TRIP_SHEET_NUMBER
Range("C12").Value = ComboBox1.Value 'Driver
Range("C14").Value = ENTRY_NUMBER


Range("H10").Value = "=TODAY()"
Range("H12").Value = ComboBox2.Value 'Vehicle
Range("H14").Value = ComboBox3.Value 'Trailer


'1
'Line1 Customer
Range("B17").Value = ComboBox4.Value
'Line1 Address
Range("C17").Value = TextBox1.Value
'Line1 Order Number
Range("D17").Value = TextBox2.Value
'Invoice Number
Range("F17").Value = TextBox3.Value
'Line1 QTY 9KG
Range("G17").Value = TextBox4.Value
'Line1 QTY 19G
Range("H17").Value = TextBox5.Value
'Line1 QTY 48KG
Range("I17").Value = TextBox6.Value


Range("J17").Value = Line1Nett


'2


Range("B18").Value = ComboBox5.Value


Range("C18").Value = TextBox7.Value


Range("D18").Value = TextBox8.Value


Range("F18").Value = TextBox9.Value


Range("G18").Value = TextBox10.Value


Range("H18").Value = TextBox11.Value


Range("I18").Value = TextBox12.Value


Range("J18").Value = Line2Nett


'3


Range("B19").Value = ComboBox6.Value


Range("C19").Value = TextBox13.Value


Range("D19").Value = TextBox14.Value


Range("F19").Value = TextBox15.Value


Range("G19").Value = TextBox16.Value


Range("H19").Value = TextBox17.Value


Range("I19").Value = TextBox18.Value


Range("J19").Value = Line3Nett




'4


Range("B20").Value = ComboBox7.Value


Range("C20").Value = TextBox19.Value


Range("D20").Value = TextBox20.Value


Range("F20").Value = TextBox21.Value


Range("G20").Value = TextBox22.Value


Range("H20").Value = TextBox23.Value


Range("I20").Value = TextBox24.Value


Range("J20").Value = Line4Nett




'5


Range("B21").Value = ComboBox8.Value


Range("C21").Value = TextBox25.Value


Range("D21").Value = TextBox26.Value


Range("F21").Value = TextBox27.Value


Range("G21").Value = TextBox28.Value


Range("H21").Value = TextBox29.Value


Range("I21").Value = TextBox30.Value


Range("J21").Value = Line5Nett




'6


Range("B22").Value = ComboBox9.Value


Range("C22").Value = TextBox31.Value


Range("D22").Value = TextBox32.Value


Range("F22").Value = TextBox33.Value


Range("G22").Value = TextBox34.Value


Range("H22").Value = TextBox35.Value


Range("I22").Value = TextBox36.Value


Range("J22").Value = Line6Nett




'7


Range("B23").Value = ComboBox10.Value


Range("C23").Value = TextBox37.Value


Range("D23").Value = TextBox38.Value


Range("F23").Value = TextBox39.Value


Range("G23").Value = TextBox40.Value


Range("H23").Value = TextBox41.Value


Range("I23").Value = TextBox42.Value


Range("J23").Value = Line7Nett




'8


Range("B24").Value = ComboBox11.Value


Range("C24").Value = TextBox43.Value


Range("D24").Value = TextBox44.Value


Range("F24").Value = TextBox45.Value


Range("G24").Value = TextBox46.Value


Range("H24").Value = TextBox47.Value


Range("I24").Value = TextBox48.Value


Range("J24").Value = Line8Nett




'9


Range("B25").Value = ComboBox12.Value


Range("C25").Value = TextBox49.Value


Range("D25").Value = TextBox50.Value


Range("F25").Value = TextBox51.Value


Range("G25").Value = TextBox52.Value


Range("H25").Value = TextBox53.Value


Range("I25").Value = TextBox54.Value


Range("J25").Value = Line9Nett




'10


Range("B26").Value = ComboBox13.Value


Range("C26").Value = TextBox55.Value


Range("D26").Value = TextBox56.Value


Range("F26").Value = TextBox57.Value


Range("G26").Value = TextBox58.Value


Range("H26").Value = TextBox59.Value


Range("I26").Value = TextBox60.Value


Range("J26").Value = Line10Nett


Range("A1:N42").Select
Selection.PrintOut


Sheets("REFUEL LPG DEPOT").Select


Range("D3").Value = (Range("D3").Value - Line1Nett)
Range("D3").Value = (Range("D3").Value - Line2Nett)
Range("D3").Value = (Range("D3").Value - Line3Nett)
Range("D3").Value = (Range("D3").Value - Line4Nett)
Range("D3").Value = (Range("D3").Value - Line5Nett)
Range("D3").Value = (Range("D3").Value - Line6Nett)
Range("D3").Value = (Range("D3").Value - Line7Nett)
Range("D3").Value = (Range("D3").Value - Line8Nett)
Range("D3").Value = (Range("D3").Value - Line9Nett)
Range("D3").Value = (Range("D3").Value - Line10Nett)


Sheets("COST").Select


'1
'Line1 Customer
Range("B34").Value = ComboBox4.Value
'Line1 Order Number
Range("C34").Value = TextBox2.Value
'Invoice Number
Range("D34").Value = TextBox3.Value
'Line1 QTY 9KG
Range("E34").Value = TextBox4.Value
'Line1 QTY 19G
Range("F34").Value = TextBox5.Value
'Line1 QTY 48KG
Range("G34").Value = TextBox6.Value
'Line1 Nett weight
Range("H34").Value = Line1Nett
'Line1 KM
Range("I34").Value = TextBox61.Value




'2


Range("B35").Value = ComboBox5.Value


Range("C35").Value = TextBox8.Value


Range("D35").Value = TextBox9.Value


Range("E35").Value = TextBox10.Value


Range("F35").Value = TextBox11.Value


Range("G35").Value = TextBox12.Value


Range("H35").Value = Line2Nett


Range("I35").Value = TextBox62.Value


'3


Range("B36").Value = ComboBox6.Value


Range("C36").Value = TextBox14.Value


Range("D36").Value = TextBox15.Value


Range("E36").Value = TextBox16.Value


Range("F36").Value = TextBox17.Value


Range("G36").Value = TextBox18.Value


Range("H36").Value = Line3Nett


Range("I36").Value = TextBox63.Value


'4


Range("B37").Value = ComboBox7.Value


Range("C37").Value = TextBox20.Value


Range("D37").Value = TextBox21.Value


Range("E37").Value = TextBox22.Value


Range("F37").Value = TextBox23.Value


Range("G37").Value = TextBox24.Value


Range("H37").Value = Line4Nett


Range("I37").Value = TextBox64.Value




'5


Range("B38").Value = ComboBox8.Value


Range("C38").Value = TextBox26.Value


Range("D38").Value = TextBox27.Value


Range("E38").Value = TextBox28.Value


Range("F38").Value = TextBox29.Value


Range("G38").Value = TextBox30.Value


Range("H38").Value = Line5Nett


Range("I38").Value = TextBox65.Value




'6


Range("B39").Value = ComboBox9.Value


Range("C39").Value = TextBox32.Value


Range("D39").Value = TextBox33.Value


Range("E39").Value = TextBox34.Value


Range("F39").Value = TextBox35.Value


Range("G39").Value = TextBox36.Value


Range("H39").Value = Line6Nett


Range("I39").Value = TextBox66.Value




'7


Range("B40").Value = ComboBox10.Value


Range("C40").Value = TextBox38.Value


Range("D40").Value = TextBox39.Value


Range("E40").Value = TextBox40.Value


Range("F40").Value = TextBox41.Value


Range("G40").Value = TextBox42.Value


Range("H40").Value = Line7Nett


Range("I40").Value = TextBox67.Value




'8


Range("B41").Value = ComboBox11.Value


Range("C41").Value = TextBox44.Value


Range("D41").Value = TextBox45.Value


Range("E41").Value = TextBox46.Value


Range("F41").Value = TextBox47.Value


Range("G41").Value = TextBox48.Value


Range("H41").Value = Line8Nett


Range("I41").Value = TextBox68.Value




'9
'Line9 Customer
Range("B42").Value = ComboBox12.Value


Range("C42").Value = TextBox50.Value


Range("D42").Value = TextBox51.Value


Range("E42").Value = TextBox52.Value


Range("F42").Value = TextBox53.Value


Range("G42").Value = TextBox54.Value


Range("H42").Value = Line9Nett


Range("I42").Value = TextBox69.Value




'10


Range("B43").Value = ComboBox13.Value


Range("C43").Value = TextBox56.Value


Range("D43").Value = TextBox57.Value


Range("E43").Value = TextBox58.Value


Range("F43").Value = TextBox59.Value


Range("G43").Value = TextBox60.Value


Range("H43").Value = Line10Nett


Range("I43").Value = TextBox70.Value


'Sales Invoice


Cost = Range("I26").Value


Sheets("INVOICE").Select




'Line1 Invoice
'Line1 Customer
Range("A10").Value = ComboBox4.Value
'Line1 Address
Range("D10").Value = TextBox1.Value
'Line1 Order Number
Range("A12").Value = TextBox2.Value
'Invoice Number
Range("F10").Value = TextBox3.Value
'Line1 QTY 9KG
Range("A14").Value = TextBox4.Value
'Line1 QTY 19G
Range("A15").Value = TextBox5.Value
'Line1 QTY 48KG
Range("A16").Value = TextBox6.Value
'Line1 Nett weight
Range("E19").Value = Line1Nett
'Line1 Cost Code entry
Range("R10").Value = ComboBox14.Value
'Line1 Vat variable
Range("R4").Value = ComboBox24.Value


'Line1 Printout
Range("A1:F41").Select
Selection.PrintOut


'Line1 PDF creator


Sheets("INVOICE").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\RefuelDropBox\Dropbox\AGH\AGH INVOICE RETAIL" & Sheets("INVOICE").Range("F10").Value & ".pdf"

'Line1 INV AMOUNT
SALESINV1 = Range("F35").Value


'Trade Invoice
Sheets("INVOICE TRADE").Select


'Line1 Invoice
'Line1 Customer
Range("A10").Value = ComboBox4.Value
'Line1 Address
Range("D10").Value = TextBox1.Value
'Line1 Order Number
Range("A12").Value = TextBox2.Value
'Invoice Number
Range("F10").Value = TextBox3.Value
'Line1 QTY 9KG
Range("A14").Value = TextBox4.Value
'Line1 QTY 19G
Range("A15").Value = TextBox5.Value
'Line1 QTY 48KG
Range("A16").Value = TextBox6.Value
'Line1 Nett weight
Range("E19").Value = Line1Nett
'Line1 Vat variable
Range("R4").Value = ComboBox24.Value


'Line1 Printout
Range("A1:F41").Select
Selection.PrintOut


'Line1 PDF creator


Sheets("INVOICE TRADE").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\RefuelDropBox\Dropbox\AGH\AGH INVOICE TRADE" & Sheets("INVOICE TRADE").Range("F10").Value & ".pdf"


'Line1 Trade Invoice Amount
TRADEINV1 = Range("F35").Value


Sheets("SALES").Select


'Line1 Sales Summary






Range("A6").Select


Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select 'Entry Number of Invoice
ActiveCell.Value = ENTRY_NUMBER
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRIP_SHEET_NUMBER 'Trip Sheet Number
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Range("C2").Value 'Date
ActiveCell.Offset(0, 1).Select 'Line1 Customer
ActiveCell.Value = ComboBox4.Value
ActiveCell.Offset(0, 1).Select 'Line1 Order Number
ActiveCell.Value = TextBox2.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox3.Value 'Invoice Number
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRADEINV1 'Trade Invoice AMount
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SALESINV1 'Sales Invoice Amount
ActiveCell.Offset(0, 1).Select 'Line1 QTY 9KG
ActiveCell.Value = TextBox4.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 19G
ActiveCell.Value = TextBox5.Value
ActiveCell.Offset(0, 1).Select 'Line1 QTY 48KG
ActiveCell.Value = TextBox6.Value
ActiveCell.Offset(0, 1).Select 'Line1 Nett Weight
ActiveCell.Value = Line1Nett
ActiveCell.Offset(0, 1).Select 'Driver
ActiveCell.Value = ComboBox1.Value
ActiveCell.Offset(0, 1).Select 'Vehicle
ActiveCell.Value = ComboBox2.Value
ActiveCell.Offset(0, 1).Select 'Trailer
ActiveCell.Value = ComboBox3.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = (Cost * Line1Nett) 'Cost per KG * Line net weight
CostNett1 = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRADEINV1 - CostNett1
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SALESINV1 - CostNett1
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox61.Value 'Line1 KMS


'Line2 Variable
If Me.TextBox9.Value = "" Then
'VEHICLE CHECKLIST
Sheets("VEHICLE CHECKLIST").Select
Range("D11").Value = ComboBox1.Value 'Driver Name
Range("D13").Value = ComboBox2.Value 'Vehicle Reg
Range("I13").Value = ComboBox3.Value 'Trailer Reg
Range("D15").Value = TRIP_SHEET_NUMBER
Range("I15").Value = ENTRY_NUMBER


Range("D69").Value = ComboBox1.Value 'Driver Name
Range("D71").Value = ComboBox2.Value 'Vehicle Reg
Range("I71").Value = ComboBox3.Value 'Trailer Reg
Range("D73").Value = TRIP_SHEET_NUMBER
Range("I73").Value = ENTRY_NUMBER


Range("A1:K109").Select
Selection.PrintOut


'Vehicle Defect Form
Sheets("DEFECT FORM").Select


Range("J10").Value = ComboBox1.Value 'Driver Name
Range("A13").Value = ComboBox2.Value 'Vehicle Reg
Range("F13").Value = ComboBox3.Value 'Trailer Reg
Range("F10").Value = TRIP_SHEET_NUMBER


Range("A2:K42").Select
Selection.PrintOut






Sheets("Summary").Select
Unload Me
Exit Sub
End If


Sheets("INVOICE").Select


'Line2 Invoice
'Line2 Customer
Range("A10").Value = ComboBox5.Value


Range("D10").Value = TextBox7.Value


Range("A12").Value = TextBox8.Value


Range("F10").Value = TextBox9.Value


Range("A14").Value = TextBox10.Value


Range("A15").Value = TextBox11.Value


Range("A16").Value = TextBox12.Value


Range("E19").Value = Line2Nett


Range("R10").Value = ComboBox15.Value


Range("R4").Value = ComboBox25.Value


'Line2 Printout
Range("A1:F41").Select
Selection.PrintOut


'Line2 PDF creator


Sheets("INVOICE").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\RefuelDropBox\Dropbox\AGH\AGH INVOICE RETAIL" & Sheets("INVOICE").Range("F10").Value & ".pdf"


'Line2 INV AMOUNT
SALESINV2 = Range("F35").Value


Sheets("INVOICE TRADE").Select


'Line2 Invoice


Range("A10").Value = ComboBox5.Value


Range("D10").Value = TextBox7.Value


Range("A12").Value = TextBox8.Value


Range("F10").Value = TextBox9.Value


Range("A14").Value = TextBox10.Value


Range("A15").Value = TextBox11.Value


Range("A16").Value = TextBox12.Value


Range("E19").Value = Line2Nett


Range("R4").Value = ComboBox25.Value


'Line2 Printout
Range("A1:F41").Select
Selection.PrintOut


'Line2 PDF creator


Sheets("INVOICE TRADE").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\RefuelDropBox\Dropbox\AGH\AGH INVOICE TRADE" & Sheets("INVOICE TRADE").Range("F10").Value & ".pdf"


'Line2 Trade Invoice Amount
TRADEINV2 = Range("F35").Value


Sheets("SALES").Select


Range("A6").Select


Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select 'Entry Number of Invoice
ActiveCell.Value = ENTRY_NUMBER
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRIP_SHEET_NUMBER 'Trip Sheet Number
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Range("C2").Value 'Date
ActiveCell.Offset(0, 1).Select 'Line2 Customer
ActiveCell.Value = ComboBox5.Value
ActiveCell.Offset(0, 1).Select 'Line2 Order Number
ActiveCell.Value = TextBox8.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox9.Value 'Invoice Number
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRADEINV2 'Trade Invoice AMount
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SALESINV2 'Sales Invoice Amount
ActiveCell.Offset(0, 1).Select 'Line2 QTY 9KG
ActiveCell.Value = TextBox10.Value
ActiveCell.Offset(0, 1).Select 'Line2 QTY 19G
ActiveCell.Value = TextBox11.Value
ActiveCell.Offset(0, 1).Select 'Line2 QTY 48KG
ActiveCell.Value = TextBox12.Value
ActiveCell.Offset(0, 1).Select 'Line2 Nett Weight
ActiveCell.Value = Line2Nett
ActiveCell.Offset(0, 1).Select 'Driver
ActiveCell.Value = ComboBox1.Value
ActiveCell.Offset(0, 1).Select 'Vehicle
ActiveCell.Value = ComboBox2.Value
ActiveCell.Offset(0, 1).Select 'Trailer
ActiveCell.Value = ComboBox3.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = (Cost * Line2Nett) 'Cost per KG * Line net weight
CostNett2 = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRADEINV2 - CostNett2
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SALESINV2 - CostNett2
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox62.Value 'Line2 KMS


'Line3 Variable
If Me.TextBox15.Value = "" Then
'VEHICLE CHECKLIST
Sheets("VEHICLE CHECKLIST").Select
Range("D11").Value = ComboBox1.Value 'Driver Name
Range("D13").Value = ComboBox2.Value 'Vehicle Reg
Range("I13").Value = ComboBox3.Value 'Trailer Reg
Range("D15").Value = TRIP_SHEET_NUMBER
Range("I15").Value = ENTRY_NUMBER


Range("D69").Value = ComboBox1.Value 'Driver Name
Range("D71").Value = ComboBox2.Value 'Vehicle Reg
Range("I71").Value = ComboBox3.Value 'Trailer Reg
Range("D73").Value = TRIP_SHEET_NUMBER
Range("I73").Value = ENTRY_NUMBER


Range("A1:K109").Select
Selection.PrintOut


'Vehicle Defect Form
Sheets("DEFECT FORM").Select


Range("J10").Value = ComboBox1.Value 'Driver Name
Range("A13").Value = ComboBox2.Value 'Vehicle Reg
Range("F13").Value = ComboBox3.Value 'Trailer Reg
Range("F10").Value = TRIP_SHEET_NUMBER


Range("A2:K42").Select
Selection.PrintOut




Sheets("Summary").Select
Unload Me
Exit Sub
End If


Sheets("INVOICE").Select




'Line3 Invoice


Range("A10").Value = ComboBox6.Value


Range("D10").Value = TextBox13.Value


Range("A12").Value = TextBox14.Value


Range("F10").Value = TextBox15.Value


Range("A14").Value = TextBox16.Value


Range("A15").Value = TextBox17.Value


Range("A16").Value = TextBox18.Value


Range("E19").Value = Line3Nett


Range("R10").Value = ComboBox16.Value


Range("R4").Value = ComboBox26.Value


Range("A1:F41").Select
Selection.PrintOut


'Line3 PDF creator


Sheets("INVOICE").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\RefuelDropBox\Dropbox\AGH\AGH INVOICE RETAIL" & Sheets("INVOICE").Range("F10").Value & ".pdf"


'Line3 INV AMOUNT
SALESINV3 = Range("F35").Value


Sheets("INVOICE TRADE").Select


'Line3 Invoice Trade


Range("A10").Value = ComboBox6.Value


Range("D10").Value = TextBox13.Value


Range("A12").Value = TextBox14.Value


Range("F10").Value = TextBox15.Value


Range("A14").Value = TextBox16.Value


Range("A15").Value = TextBox17.Value


Range("A16").Value = TextBox18.Value


Range("E19").Value = Line3Nett


Range("R4").Value = ComboBox26.Value


'Line3 Printout
Range("A1:F41").Select
Selection.PrintOut


'Line3 PDF creator


Sheets("INVOICE TRADE").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\RefuelDropBox\Dropbox\AGH\AGH INVOICE TRADE" & Sheets("INVOICE TRADE").Range("F10").Value & ".pdf"


'Line3 Trade Invoice Amount
TRADEINV3 = Range("F35").Value




Sheets("SALES").Select


Range("A6").Select


Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select 'Entry Number of Invoice
ActiveCell.Value = ENTRY_NUMBER
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRIP_SHEET_NUMBER 'Trip Sheet Number
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Range("C2").Value 'Date
ActiveCell.Offset(0, 1).Select 'Line3 Customer
ActiveCell.Value = ComboBox6.Value
ActiveCell.Offset(0, 1).Select 'Line3 Order Number
ActiveCell.Value = TextBox14.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox15.Value 'Invoice Number
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRADEINV3 'Trade Invoice AMount
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SALESINV3 'Sales Invoice Amount
ActiveCell.Offset(0, 1).Select 'Line3 QTY 9KG
ActiveCell.Value = TextBox16.Value
ActiveCell.Offset(0, 1).Select 'Line3 QTY 19G
ActiveCell.Value = TextBox17.Value
ActiveCell.Offset(0, 1).Select 'Line3 QTY 48KG
ActiveCell.Value = TextBox18.Value
ActiveCell.Offset(0, 1).Select 'Line3 Nett Weight
ActiveCell.Value = Line3Nett
ActiveCell.Offset(0, 1).Select 'Driver
ActiveCell.Value = ComboBox1.Value
ActiveCell.Offset(0, 1).Select 'Vehicle
ActiveCell.Value = ComboBox2.Value
ActiveCell.Offset(0, 1).Select 'Trailer
ActiveCell.Value = ComboBox3.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = (Cost * Line3Nett) 'Cost per KG * Line net weight
CostNett3 = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRADEINV3 - CostNett3
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SALESINV3 - CostNett3
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox63.Value 'Line3 KMS




'Line4 Variable
If Me.TextBox21.Value = "" Then
'VEHICLE CHECKLIST
Sheets("VEHICLE CHECKLIST").Select
Range("D11").Value = ComboBox1.Value 'Driver Name
Range("D13").Value = ComboBox2.Value 'Vehicle Reg
Range("I13").Value = ComboBox3.Value 'Trailer Reg
Range("D15").Value = TRIP_SHEET_NUMBER
Range("I15").Value = ENTRY_NUMBER


Range("D69").Value = ComboBox1.Value 'Driver Name
Range("D71").Value = ComboBox2.Value 'Vehicle Reg
Range("I71").Value = ComboBox3.Value 'Trailer Reg
Range("D73").Value = TRIP_SHEET_NUMBER
Range("I73").Value = ENTRY_NUMBER


Range("A1:K109").Select
Selection.PrintOut


'Vehicle Defect Form
Sheets("DEFECT FORM").Select


Range("J10").Value = ComboBox1.Value 'Driver Name
Range("A13").Value = ComboBox2.Value 'Vehicle Reg
Range("F13").Value = ComboBox3.Value 'Trailer Reg
Range("F10").Value = TRIP_SHEET_NUMBER


Range("A2:K42").Select
Selection.PrintOut


Sheets("Summary").Select
Unload Me
Exit Sub
End If


Sheets("INVOICE").Select


'Line4 Invoice
'Line4 Customer
Range("A10").Value = ComboBox7.Value


Range("D10").Value = TextBox19.Value


Range("A12").Value = TextBox20.Value


Range("F10").Value = TextBox21.Value


Range("A14").Value = TextBox22.Value


Range("A15").Value = TextBox23.Value


Range("A16").Value = TextBox24.Value


Range("E19").Value = Line4Nett


Range("R10").Value = ComboBox17.Value


Range("R4").Value = ComboBox27.Value


'Line4 Printout
Range("A1:F41").Select
Selection.PrintOut


'Line4 PDF creator


Sheets("INVOICE").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\RefuelDropBox\Dropbox\AGH\AGH INVOICE RETAIL" & Sheets("INVOICE").Range("F10").Value & ".pdf"


'Line4 INV AMOUNT
SALESINV4 = Range("F35").Value




Sheets("INVOICE TRADE").Select


'Line4 Invoice


Range("A10").Value = ComboBox7.Value


Range("D10").Value = TextBox19.Value


Range("A12").Value = TextBox20.Value


Range("F10").Value = TextBox21.Value


Range("A14").Value = TextBox22.Value


Range("A15").Value = TextBox23.Value


Range("A16").Value = TextBox24.Value


Range("E19").Value = Line4Nett


Range("R4").Value = ComboBox27.Value


'Line4 PrintOut
Range("A1:F41").Select
Selection.PrintOut


'Line4 PDF creator


Sheets("INVOICE TRADE").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\RefuelDropBox\Dropbox\AGH\AGH INVOICE TRADE" & Sheets("INVOICE TRADE").Range("F10").Value & ".pdf"


'Line4 Trade Invoice Amount
TRADEINV4 = Range("F35").Value


Sheets("SALES").Select


Range("A6").Select


Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select 'Entry Number of Invoice
ActiveCell.Value = ENTRY_NUMBER
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRIP_SHEET_NUMBER 'Trip Sheet Number
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Range("C2").Value 'Date
ActiveCell.Offset(0, 1).Select 'Line4 Customer
ActiveCell.Value = ComboBox7.Value
ActiveCell.Offset(0, 1).Select 'Line4 Order Number
ActiveCell.Value = TextBox20.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox21.Value 'Invoice Number
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRADEINV4 'Trade Invoice AMount
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SALESINV4 'Sales Invoice Amount
ActiveCell.Offset(0, 1).Select 'Line4 QTY 9KG
ActiveCell.Value = TextBox22.Value
ActiveCell.Offset(0, 1).Select 'Line4 QTY 19G
ActiveCell.Value = TextBox23.Value
ActiveCell.Offset(0, 1).Select 'Line4 QTY 48KG
ActiveCell.Value = TextBox24.Value
ActiveCell.Offset(0, 1).Select 'Line4 Nett Weight
ActiveCell.Value = Line4Nett
ActiveCell.Offset(0, 1).Select 'Driver
ActiveCell.Value = ComboBox1.Value
ActiveCell.Offset(0, 1).Select 'Vehicle
ActiveCell.Value = ComboBox2.Value
ActiveCell.Offset(0, 1).Select 'Trailer
ActiveCell.Value = ComboBox3.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = (Cost * Line4Nett) 'Cost per KG * Line net weight
CostNett4 = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRADEINV4 - CostNett4
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SALESINV4 - CostNett4
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox64.Value 'Line4 KMS


'Line5 Variable
If Me.TextBox27.Value = "" Then
'VEHICLE CHECKLIST
Sheets("VEHICLE CHECKLIST").Select
Range("D11").Value = ComboBox1.Value 'Driver Name
Range("D13").Value = ComboBox2.Value 'Vehicle Reg
Range("I13").Value = ComboBox3.Value 'Trailer Reg
Range("D15").Value = TRIP_SHEET_NUMBER
Range("I15").Value = ENTRY_NUMBER


Range("D69").Value = ComboBox1.Value 'Driver Name
Range("D71").Value = ComboBox2.Value 'Vehicle Reg
Range("I71").Value = ComboBox3.Value 'Trailer Reg
Range("D73").Value = TRIP_SHEET_NUMBER
Range("I73").Value = ENTRY_NUMBER


Range("A1:K109").Select
Selection.PrintOut


'Vehicle Defect Form
Sheets("DEFECT FORM").Select


Range("J10").Value = ComboBox1.Value 'Driver Name
Range("A13").Value = ComboBox2.Value 'Vehicle Reg
Range("F13").Value = ComboBox3.Value 'Trailer Reg
Range("F10").Value = TRIP_SHEET_NUMBER


Range("A2:K42").Select
Selection.PrintOut


Sheets("Summary").Select
Unload Me
Exit Sub
End If


Sheets("INVOICE").Select


'Line5 Invoice
'Line5 Customer
Range("A10").Value = ComboBox8.Value
'Line5 Address
Range("D10").Value = TextBox25.Value
'Line5 Order Number
Range("A12").Value = TextBox26.Value
'Invoice Number
Range("F10").Value = TextBox27.Value
'Line5 QTY 9KG
Range("A14").Value = TextBox28.Value
'Line5 QTY 19G
Range("A15").Value = TextBox29.Value
'Line5 QTY 48KG
Range("A16").Value = TextBox30.Value
'Line5 Nett weight
Range("E19").Value = Line5Nett
'Line5 Cost Code entry
Range("R10").Value = ComboBox18.Value
'Line5 Vat variable
Range("R4").Value = ComboBox28.Value


'Line5 Printout
Range("A1:F41").Select
Selection.PrintOut


'Line5 PDF creator


Sheets("INVOICE").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\RefuelDropBox\Dropbox\AGH\AGH INVOICE RETAIL" & Sheets("INVOICE").Range("F10").Value & ".pdf"


'Line5 INV AMOUNT
SALESINV5 = Range("F35").Value


Sheets("INVOICE TRADE").Select


'Line5 Invoice
'Line5 Customer
Range("A10").Value = ComboBox8.Value
'Line5 Address
Range("D10").Value = TextBox25.Value
'Line5 Order Number
Range("A12").Value = TextBox26.Value
'Invoice Number
Range("F10").Value = TextBox27.Value
'Line5 QTY 9KG
Range("A14").Value = TextBox28.Value
'Line5 QTY 19G
Range("A15").Value = TextBox29.Value
'Line5 QTY 48KG
Range("A16").Value = TextBox30.Value
'Line5 Nett weight
Range("E19").Value = Line5Nett
'Line5 Vat variable
Range("R4").Value = ComboBox28.Value


'Line5 Printout
Range("A1:F41").Select
Selection.PrintOut


'Line5 PDF creator


Sheets("INVOICE TRADE").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\RefuelDropBox\Dropbox\AGH\AGH INVOICE TRADE" & Sheets("INVOICE TRADE").Range("F10").Value & ".pdf"


'Line5 Trade Invoice Amount
TRADEINV5 = Range("F35").Value


Sheets("SALES").Seleect


Range("A6").Select


Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select 'Entry Number of Invoice
ActiveCell.Value = ENTRY_NUMBER
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRIP_SHEET_NUMBER 'Trip Sheet Number
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Range("C2").Value 'Date
ActiveCell.Offset(0, 1).Select 'Line5 Customer
ActiveCell.Value = ComboBox8.Value
ActiveCell.Offset(0, 1).Select 'Line5 Order Number
ActiveCell.Value = TextBox26.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox27.Value 'Invoice Number
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRADEINV5 'Trade Invoice AMount
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SALESINV5 'Sales Invoice Amount
ActiveCell.Offset(0, 1).Select 'Line5 QTY 9KG
ActiveCell.Value = TextBox28.Value
ActiveCell.Offset(0, 1).Select 'Line5 QTY 19G
ActiveCell.Value = TextBox29.Value
ActiveCell.Offset(0, 1).Select 'Line5 QTY 48KG
ActiveCell.Value = TextBox30.Value
ActiveCell.Offset(0, 1).Select 'Line5 Nett Weight
ActiveCell.Value = Line5Nett
ActiveCell.Offset(0, 1).Select 'Driver
ActiveCell.Value = ComboBox1.Value
ActiveCell.Offset(0, 1).Select 'Vehicle
ActiveCell.Value = ComboBox2.Value
ActiveCell.Offset(0, 1).Select 'Trailer
ActiveCell.Value = ComboBox3.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = (Cost * Line5Nett) 'Cost per KG * Line net weight
CostNett5 = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRADEINV5 - CostNett5
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SALESINV5 - CostNett5
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox65.Value 'Line5 KMS


'Line6 Variable
If Me.TextBox33.Value = "" Then
'VEHICLE CHECKLIST
Sheets("VEHICLE CHECKLIST").Select
Range("D11").Value = ComboBox1.Value 'Driver Name
Range("D13").Value = ComboBox2.Value 'Vehicle Reg
Range("I13").Value = ComboBox3.Value 'Trailer Reg
Range("D15").Value = TRIP_SHEET_NUMBER
Range("I15").Value = ENTRY_NUMBER


Range("D69").Value = ComboBox1.Value 'Driver Name
Range("D71").Value = ComboBox2.Value 'Vehicle Reg
Range("I71").Value = ComboBox3.Value 'Trailer Reg
Range("D73").Value = TRIP_SHEET_NUMBER
Range("I73").Value = ENTRY_NUMBER


Range("A1:K109").Select
Selection.PrintOut


'Vehicle Defect Form
Sheets("DEFECT FORM").Select


Range("J10").Value = ComboBox1.Value 'Driver Name
Range("A13").Value = ComboBox2.Value 'Vehicle Reg
Range("F13").Value = ComboBox3.Value 'Trailer Reg
Range("F10").Value = TRIP_SHEET_NUMBER


Range("A2:K42").Select
Selection.PrintOut


Sheets("Summary").Select
Unload Me
Exit Sub
End If


Sheets("INVOICE").Select


'Line6 Invoice
'Line6 Customer
Range("A10").Value = ComboBox9.Value
'Line6 Address
Range("D10").Value = TextBox31.Value
'Line6 Order Number
Range("A12").Value = TextBox32.Value
'Invoice Number
Range("F10").Value = TextBox33.Value
'Line6 QTY 9KG
Range("A14").Value = TextBox34.Value
'Line6 QTY 19G
Range("A15").Value = TextBox35.Value
'Line6 QTY 48KG
Range("A16").Value = TextBox36.Value
'Line6 Nett weight
Range("E19").Value = Line6Nett
'Line6 Cost Code entry
Range("R10").Value = ComboBox19.Value
'Line6 Vat variable
Range("R4").Value = ComboBox29.Value


'Line6 PrintOut
Range("A1:F41").Select
Selection.PrintOut


'Line6 PDF creator


Sheets("INVOICE").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\RefuelDropBox\Dropbox\AGH\AGH INVOICE RETAIL" & Sheets("INVOICE").Range("F10").Value & ".pdf"


'Line6 INV AMOUNT
SALESINV6 = Range("F35").Value


Sheets("INVOICE TRADE").Select


'Line6 Invoice
'Line6 Customer
Range("A10").Value = ComboBox9.Value
'Line6 Address
Range("D10").Value = TextBox31.Value
'Line6 Order Number
Range("A12").Value = TextBox32.Value
'Invoice Number
Range("F10").Value = TextBox33.Value
'Line6 QTY 9KG
Range("A14").Value = TextBox34.Value
'Line6 QTY 19G
Range("A15").Value = TextBox35.Value
'Line6 QTY 48KG
Range("A16").Value = TextBox36.Value
'Line6 Nett weight
Range("E19").Value = Line6Nett
'Line6 Vat variable
Range("R4").Value = ComboBox29.Value


'Line6 Printout
Range("A1:F41").Select
Selection.PrintOut


'Line6 PDF creator


Sheets("INVOICE TRADE").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\RefuelDropBox\Dropbox\AGH\AGH INVOICE TRADE" & Sheets("INVOICE TRADE").Range("F10").Value & ".pdf"


'Line6 Trade Invoice Amount
TRADEINV6 = Range("F35").Value


Sheets("SALES").Select


Range("A6").Select


Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select 'Entry Number of Invoice
ActiveCell.Value = ENTRY_NUMBER
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRIP_SHEET_NUMBER 'Trip Sheet Number
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Range("C2").Value 'Date
ActiveCell.Offset(0, 1).Select 'Line6 Customer
ActiveCell.Value = ComboBox9.Value
ActiveCell.Offset(0, 1).Select 'Line6 Order Number
ActiveCell.Value = TextBox32.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox33.Value 'Invoice Number
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRADEINV6 'Trade Invoice AMount
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SALESINV6 'Sales Invoice Amount
ActiveCell.Offset(0, 1).Select 'Line6 QTY 9KG
ActiveCell.Value = TextBox34.Value
ActiveCell.Offset(0, 1).Select 'Line6 QTY 19G
ActiveCell.Value = TextBox35.Value
ActiveCell.Offset(0, 1).Select 'Line6 QTY 48KG
ActiveCell.Value = TextBox36.Value
ActiveCell.Offset(0, 1).Select 'Line6 Nett Weight
ActiveCell.Value = Line6Nett
ActiveCell.Offset(0, 1).Select 'Driver
ActiveCell.Value = ComboBox1.Value
ActiveCell.Offset(0, 1).Select 'Vehicle
ActiveCell.Value = ComboBox2.Value
ActiveCell.Offset(0, 1).Select 'Trailer
ActiveCell.Value = ComboBox3.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = (Cost * Line6Nett) 'Cost per KG * Line net weight
CostNett6 = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRADEINV6 - CostNett6
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SALESINV6 - CostNett6
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox66.Value 'Line6 KMS


'Line7 Variable
If Me.TextBox39.Value = "" Then
'VEHICLE CHECKLIST
Sheets("VEHICLE CHECKLIST").Select
Range("D11").Value = ComboBox1.Value 'Driver Name
Range("D13").Value = ComboBox2.Value 'Vehicle Reg
Range("I13").Value = ComboBox3.Value 'Trailer Reg
Range("D15").Value = TRIP_SHEET_NUMBER
Range("I15").Value = ENTRY_NUMBER


Range("D69").Value = ComboBox1.Value 'Driver Name
Range("D71").Value = ComboBox2.Value 'Vehicle Reg
Range("I71").Value = ComboBox3.Value 'Trailer Reg
Range("D73").Value = TRIP_SHEET_NUMBER
Range("I73").Value = ENTRY_NUMBER


Range("A1:K109").Select
Selection.PrintOut


'Vehicle Defect Form
Sheets("DEFECT FORM").Select


Range("J10").Value = ComboBox1.Value 'Driver Name
Range("A13").Value = ComboBox2.Value 'Vehicle Reg
Range("F13").Value = ComboBox3.Value 'Trailer Reg
Range("F10").Value = TRIP_SHEET_NUMBER


Range("A2:K42").Select
Selection.PrintOut


Sheets("Summary").Select
Unload Me
Exit Sub
End If


Sheets("INVOICE").Select




'Line7 Invoice


Range("A10").Value = ComboBox10.Value


Range("D10").Value = TextBox37.Value


Range("A12").Value = TextBox38.Value


Range("F10").Value = TextBox39.Value


Range("A14").Value = TextBox40.Value


Range("A15").Value = TextBox41.Value


Range("A16").Value = TextBox42.Value


Range("E19").Value = Line7Nett


Range("R10").Value = ComboBox20.Value


Range("R4").Value = ComboBox30.Value


'Line7 Printout
Range("A1:F41").Select
Selection.PrintOut


'Line7 PDF creator


Sheets("INVOICE").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\RefuelDropBox\Dropbox\AGH\AGH INVOICE RETAIL" & Sheets("INVOICE").Range("F10").Value & ".pdf"


'Line7 INV AMOUNT
SALESINV7 = Range("F35").Value


Sheets("INVOICE TRADE").Select


'Line7 Invoice


Range("A10").Value = ComboBox10.Value


Range("D10").Value = TextBox37.Value


Range("A12").Value = TextBox38.Value


Range("F10").Value = TextBox39.Value


Range("A14").Value = TextBox40.Value


Range("A15").Value = TextBox41.Value


Range("A16").Value = TextBox42.Value


Range("E19").Value = Line7Nett


Range("R4").Value = ComboBox30.Value


'Line7 Printout
Range("A1:F41").Select
Selection.PrintOut


'Line7 PDF creator


Sheets("INVOICE TRADE").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\RefuelDropBox\Dropbox\AGH\AGH INVOICE TRADE" & Sheets("INVOICE TRADE").Range("F10").Value & ".pdf"


'Line7 Trade Invoice Amount
TRADEINV7 = Range("F35").Value


Sheets("SALES").Select


Range("A6").Select


Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select 'Entry Number of Invoice
ActiveCell.Value = ENTRY_NUMBER
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRIP_SHEET_NUMBER 'Trip Sheet Number
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Range("C2").Value 'Date
ActiveCell.Offset(0, 1).Select 'Line7 Customer
ActiveCell.Value = ComboBox10.Value
ActiveCell.Offset(0, 1).Select 'Line7 Order Number
ActiveCell.Value = TextBox38.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox39.Value 'Invoice Number
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRADEINV7 'Trade Invoice AMount
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SALESINV7 'Sales Invoice Amount
ActiveCell.Offset(0, 1).Select 'Line7 QTY 9KG
ActiveCell.Value = TextBox40.Value
ActiveCell.Offset(0, 1).Select 'Line7 QTY 19G
ActiveCell.Value = TextBox41.Value
ActiveCell.Offset(0, 1).Select 'Line7 QTY 48KG
ActiveCell.Value = TextBox42.Value
ActiveCell.Offset(0, 1).Select 'Line7 Nett Weight
ActiveCell.Value = Line7Nett
ActiveCell.Offset(0, 1).Select 'Driver
ActiveCell.Value = ComboBox1.Value
ActiveCell.Offset(0, 1).Select 'Vehicle
ActiveCell.Value = ComboBox2.Value
ActiveCell.Offset(0, 1).Select 'Trailer
ActiveCell.Value = ComboBox3.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = (Cost * Line7Nett) 'Cost per KG * Line net weight
CostNett7 = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRADEINV7 - CostNett7
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SALESINV7 - CostNett7
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox67.Value 'Line7 KMS


'Line8 Variable
If Me.TextBox45.Value = "" Then
'VEHICLE CHECKLIST
Sheets("VEHICLE CHECKLIST").Select
Range("D11").Value = ComboBox1.Value 'Driver Name
Range("D13").Value = ComboBox2.Value 'Vehicle Reg
Range("I13").Value = ComboBox3.Value 'Trailer Reg
Range("D15").Value = TRIP_SHEET_NUMBER
Range("I15").Value = ENTRY_NUMBER


Range("D69").Value = ComboBox1.Value 'Driver Name
Range("D71").Value = ComboBox2.Value 'Vehicle Reg
Range("I71").Value = ComboBox3.Value 'Trailer Reg
Range("D73").Value = TRIP_SHEET_NUMBER
Range("I73").Value = ENTRY_NUMBER


Range("A1:K109").Select
Selection.PrintOut


'Vehicle Defect Form
Sheets("DEFECT FORM").Select


Range("J10").Value = ComboBox1.Value 'Driver Name
Range("A13").Value = ComboBox2.Value 'Vehicle Reg
Range("F13").Value = ComboBox3.Value 'Trailer Reg
Range("F10").Value = TRIP_SHEET_NUMBER


Range("A2:K42").Select
Selection.PrintOut


Sheets("Summary").Select
Unload Me
Exit Sub
End If


Sheets("INVOICE").Select


'Line8 Invoice


Range("A10").Value = ComboBox11.Value


Range("D10").Value = TextBox43.Value


Range("A12").Value = TextBox44.Value


Range("F10").Value = TextBox45.Value


Range("A14").Value = TextBox46.Value


Range("A15").Value = TextBox47.Value


Range("A16").Value = TextBox48.Value


Range("E19").Value = Line8Nett


Range("R10").Value = ComboBox21.Value


Range("R4").Value = ComboBox31.Value


'Line8 Printout
Range("A1:F41").Select
Selection.PrintOut


'Line8 PDF creator


Sheets("INVOICE").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\RefuelDropBox\Dropbox\AGH\AGH INVOICE RETAIL" & Sheets("INVOICE").Range("F10").Value & ".pdf"


'Line8 INV AMOUNT
SALESINV8 = Range("F35").Value


Sheets("INVOICE TRADE").Select


'Line8 Invoice


Range("A10").Value = ComboBox11.Value


Range("D10").Value = TextBox43.Value


Range("A12").Value = TextBox44.Value


Range("F10").Value = TextBox45.Value


Range("A14").Value = TextBox46.Value


Range("A15").Value = TextBox47.Value


Range("A16").Value = TextBox48.Value


Range("E19").Value = Line8Nett


Range("R4").Value = ComboBox31.Value


'Line8 Printout
Range("A1:F41").Select
Selection.PrintOut


'Line8 PDF creator


Sheets("INVOICE TRADE").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\RefuelDropBox\Dropbox\AGH\AGH INVOICE TRADE" & Sheets("INVOICE TRADE").Range("F10").Value & ".pdf"


'Line8 Trade Invoice Amount
TRADEINV8 = Range("F35").Value


Sheets("SALES").Select


Range("A6").Select


Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select 'Entry Number of Invoice
ActiveCell.Value = ENTRY_NUMBER
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRIP_SHEET_NUMBER 'Trip Sheet Number
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Range("C2").Value 'Date
ActiveCell.Offset(0, 1).Select 'Line8 Customer
ActiveCell.Value = ComboBox11.Value
ActiveCell.Offset(0, 1).Select 'Line8 Order Number
ActiveCell.Value = TextBox44.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox45.Value 'Invoice Number
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRADEINV8 'Trade Invoice AMount
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SALESINV8 'Sales Invoice Amount
ActiveCell.Offset(0, 1).Select 'Line8 QTY 9KG
ActiveCell.Value = TextBox46.Value
ActiveCell.Offset(0, 1).Select 'Line8 QTY 19G
ActiveCell.Value = TextBox47.Value
ActiveCell.Offset(0, 1).Select 'Line8 QTY 48KG
ActiveCell.Value = TextBox48.Value
ActiveCell.Offset(0, 1).Select 'Line8 Nett Weight
ActiveCell.Value = Line8Nett
ActiveCell.Offset(0, 1).Select 'Driver
ActiveCell.Value = ComboBox1.Value
ActiveCell.Offset(0, 1).Select 'Vehicle
ActiveCell.Value = ComboBox2.Value
ActiveCell.Offset(0, 1).Select 'Trailer
ActiveCell.Value = ComboBox3.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = (Cost * Line8Nett) 'Cost per KG * Line net weight
CostNett8 = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRADEINV8 - CostNett8
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SALESINV8 - CostNett8
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox68.Value 'Line8 KMS


'Line9 Variable
If Me.TextBox51.Value = "" Then
'VEHICLE CHECKLIST
Sheets("VEHICLE CHECKLIST").Select
Range("D11").Value = ComboBox1.Value 'Driver Name
Range("D13").Value = ComboBox2.Value 'Vehicle Reg
Range("I13").Value = ComboBox3.Value 'Trailer Reg
Range("D15").Value = TRIP_SHEET_NUMBER
Range("I15").Value = ENTRY_NUMBER


Range("D69").Value = ComboBox1.Value 'Driver Name
Range("D71").Value = ComboBox2.Value 'Vehicle Reg
Range("I71").Value = ComboBox3.Value 'Trailer Reg
Range("D73").Value = TRIP_SHEET_NUMBER
Range("I73").Value = ENTRY_NUMBER


Range("A1:K109").Select
Selection.PrintOut


'Vehicle Defect Form
Sheets("DEFECT FORM").Select


Range("J10").Value = ComboBox1.Value 'Driver Name
Range("A13").Value = ComboBox2.Value 'Vehicle Reg
Range("F13").Value = ComboBox3.Value 'Trailer Reg
Range("F10").Value = TRIP_SHEET_NUMBER


Range("A2:K42").Select
Selection.PrintOut






Sheets("Summary").Select
Unload Me
Exit Sub
End If


Sheets("INVOICE").Select


'Line9 Invoice


Range("A10").Value = ComboBox12.Value
'
Range("D10").Value = TextBox49.Value


Range("A12").Value = TextBox50.Value


Range("F10").Value = TextBox51.Value


Range("A14").Value = TextBox52.Value


Range("A15").Value = TextBox53.Value


Range("A16").Value = TextBox54.Value


Range("E19").Value = Line9Nett


Range("R10").Value = ComboBox22.Value


Range("R4").Value = ComboBox32.Value


'Line9 Printout
Range("A1:F41").Select
Selection.PrintOut


'Line9 PDF creator


Sheets("INVOICE").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\RefuelDropBox\Dropbox\AGH\AGH INVOICE RETAIL" & Sheets("INVOICE").Range("F10").Value & ".pdf"


'Line9 INV AMOUNT
SALESINV9 = Range("F35").Value


Sheets("INVOICE TRADE").Select


'Line9 Invoice


Range("A10").Value = ComboBox12.Value


Range("D10").Value = TextBox49.Value


Range("A12").Value = TextBox50.Value


Range("F10").Value = TextBox51.Value


Range("A14").Value = TextBox52.Value


Range("A15").Value = TextBox53.Value


Range("A16").Value = TextBox54.Value


Range("E19").Value = Line9Nett


Range("R4").Value = ComboBox32.Value


'Line9 Printout
Range("A1:F41").Select
Selection.PrintOut


'Line9 PDF creator


Sheets("INVOICE TRADE").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\RefuelDropBox\Dropbox\AGH\AGH INVOICE TRADE" & Sheets("INVOICE TRADE").Range("F10").Value & ".pdf"


'Line9 Trade Invoice Amount
TRADEINV9 = Range("F35").Value


Sheets("SALES").Select


Range("A6").Select


Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select 'Entry Number of Invoice
ActiveCell.Value = ENTRY_NUMBER
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRIP_SHEET_NUMBER 'Trip Sheet Number
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Range("C2").Value 'Date
ActiveCell.Offset(0, 1).Select 'Line9 Customer
ActiveCell.Value = ComboBox12.Value
ActiveCell.Offset(0, 1).Select 'Line9 Order Number
ActiveCell.Value = TextBox50.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox51.Value 'Invoice Number
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRADEINV9 'Trade Invoice AMount
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SALESINV9 'Sales Invoice Amount
ActiveCell.Offset(0, 1).Select 'Line9 QTY 9KG
ActiveCell.Value = TextBox52.Value
ActiveCell.Offset(0, 1).Select 'Line9 QTY 19G
ActiveCell.Value = TextBox53.Value
ActiveCell.Offset(0, 1).Select 'Line9 QTY 48KG
ActiveCell.Value = TextBox54.Value
ActiveCell.Offset(0, 1).Select 'Line9 Nett Weight
ActiveCell.Value = Line9Nett
ActiveCell.Offset(0, 1).Select 'Driver
ActiveCell.Value = ComboBox1.Value
ActiveCell.Offset(0, 1).Select 'Vehicle
ActiveCell.Value = ComboBox2.Value
ActiveCell.Offset(0, 1).Select 'Trailer
ActiveCell.Value = ComboBox3.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = (Cost * Line9Nett) 'Cost per KG * Line net weight
CostNett9 = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRADEINV9 - CostNett9
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SALESINV9 - CostNett9
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox69.Value 'Line9 KMS


'Line10 Variable
If Me.TextBox57.Value = "" Then
'VEHICLE CHECKLIST
Sheets("VEHICLE CHECKLIST").Select
Range("D11").Value = ComboBox1.Value 'Driver Name
Range("D13").Value = ComboBox2.Value 'Vehicle Reg
Range("I13").Value = ComboBox3.Value 'Trailer Reg
Range("D15").Value = TRIP_SHEET_NUMBER
Range("I15").Value = ENTRY_NUMBER


Range("D69").Value = ComboBox1.Value 'Driver Name
Range("D71").Value = ComboBox2.Value 'Vehicle Reg
Range("I71").Value = ComboBox3.Value 'Trailer Reg
Range("D73").Value = TRIP_SHEET_NUMBER
Range("I73").Value = ENTRY_NUMBER


Range("A1:K109").Select
Selection.PrintOut


'Vehicle Defect Form
Sheets("DEFECT FORM").Select


Range("J10").Value = ComboBox1.Value 'Driver Name
Range("A13").Value = ComboBox2.Value 'Vehicle Reg
Range("F13").Value = ComboBox3.Value 'Trailer Reg
Range("F10").Value = TRIP_SHEET_NUMBER


Range("A2:K42").Select
Selection.PrintOut








Sheets("Summary").Select
Unload Me
Exit Sub
End If


Sheets("INVOICE").Select


'Line10 Invoice


Range("A10").Value = ComboBox13.Value


Range("D10").Value = TextBox55.Value


Range("A12").Value = TextBox56.Value


Range("F10").Value = TextBox57.Value


Range("A14").Value = TextBox58.Value


Range("A15").Value = TextBox59.Value


Range("A16").Value = TextBox60.Value


Range("E19").Value = Line10Nett


Range("R10").Value = ComboBox23.Value


Range("R4").Value = ComboBox33.Value


'Line10 Printout
Range("A1:F41").Select
Selection.PrintOut


'Line10 PDF creator


Sheets("INVOICE").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\RefuelDropBox\Dropbox\AGH\AGH INVOICE RETAIL" & Sheets("INVOICE").Range("F10").Value & ".pdf"


'Line10 INV AMOUNT
SALESINV10 = Range("F35").Value


Sheets("INVOICE TRADE").Select


'Line10 Invoice


Range("A10").Value = ComboBox13.Value


Range("D10").Value = TextBox55.Value


Range("A12").Value = TextBox56.Value


Range("F10").Value = TextBox57.Value


Range("A14").Value = TextBox58.Value


Range("A15").Value = TextBox59.Value


Range("A16").Value = TextBox60.Value


Range("E19").Value = Line10Nett


Range("R4").Value = ComboBox33.Value


'Line10 Printout
Range("A1:F41").Select
Selection.PrintOut


'Line10 PDF creator


Sheets("INVOICE TRADE").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\RefuelDropBox\Dropbox\AGH\AGH INVOICE TRADE" & Sheets("INVOICE TRADE").Range("F10").Value & ".pdf"


'Line10 Trade Invoice Amount
TRADEINV10 = Range("F35").Value


Sheets("SALES").Select


Range("A6").Select


Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select 'Entry Number of Invoice
ActiveCell.Value = ENTRY_NUMBER
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRIP_SHEET_NUMBER 'Trip Sheet Number
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Range("C2").Value 'Date
ActiveCell.Offset(0, 1).Select 'Line10 Customer
ActiveCell.Value = ComboBox13.Value
ActiveCell.Offset(0, 1).Select 'Line10 Order Number
ActiveCell.Value = TextBox56.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox57.Value 'Invoice Number
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRADEINV10 'Trade Invoice AMount
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SALESINV10 'Sales Invoice Amount
ActiveCell.Offset(0, 1).Select 'Line10 QTY 9KG
ActiveCell.Value = TextBox58.Value
ActiveCell.Offset(0, 1).Select 'Line10 QTY 19G
ActiveCell.Value = TextBox59.Value
ActiveCell.Offset(0, 1).Select 'Line10 QTY 48KG
ActiveCell.Value = TextBox60.Value
ActiveCell.Offset(0, 1).Select 'Line10 Nett Weight
ActiveCell.Value = Line10Nett
ActiveCell.Offset(0, 1).Select 'Driver
ActiveCell.Value = ComboBox1.Value
ActiveCell.Offset(0, 1).Select 'Vehicle
ActiveCell.Value = ComboBox2.Value
ActiveCell.Offset(0, 1).Select 'Trailer
ActiveCell.Value = ComboBox3.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = (Cost * Line10Nett) 'Cost per KG * Line net weight
CostNett10 = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TRADEINV10 - CostNett10
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = SALESINV10 - CostNett10
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TextBox70.Value 'Line10 KMS


'VEHICLE CHECKLIST
Sheets("VEHICLE CHECKLIST").Select
Range("D11").Value = ComboBox1.Value 'Driver Name
Range("D13").Value = ComboBox2.Value 'Vehicle Reg
Range("I13").Value = ComboBox3.Value 'Trailer Reg
Range("D15").Value = TRIP_SHEET_NUMBER
Range("I15").Value = ENTRY_NUMBER


Range("D69").Value = ComboBox1.Value 'Driver Name
Range("D71").Value = ComboBox2.Value 'Vehicle Reg
Range("I71").Value = ComboBox3.Value 'Trailer Reg
Range("D73").Value = TRIP_SHEET_NUMBER
Range("I73").Value = ENTRY_NUMBER


Range("A1:K109").Select
Selection.PrintOut




'Vehicle Defect Form
Sheets("DEFECT FORM").Select


Range("J10").Value = ComboBox1.Value 'Driver Name
Range("A13").Value = ComboBox2.Value 'Vehicle Reg
Range("F13").Value = ComboBox3.Value 'Trailer Reg
Range("F10").Value = TRIP_SHEET_NUMBER


Range("A2:K42").Select
Selection.PrintOut


Sheets("Summary").Select
Unload Me






End Sub
 
Upvote 0
I too am new to VBA and have a similar Problem.

I need to shorten my VBA code as I am getting Procedure too large error, Code is like this


Private Sub Worksheet_change(ByVal Target As Range)

If Not Intersect(Target, Range("p5")) Is Nothing Then
If Target = Range("p5") Then


If Sheets("Forecast").Range("p5").Value <> Target.Value Then
Sheets("Forecast").Range("p5").Value = Target.Value
End If
End If
End If


If Not Intersect(Target, Range("p6")) Is Nothing Then
If Target = Range("p6") Then


If Sheets("Forecast").Range("p6").Value <> Target.Value Then
Sheets("Forecast").Range("p6").Value = Target.Value
End If
End If
End If


If Not Intersect(Target, Range("P7")) Is Nothing Then
If Target = Range("P7") Then


If Sheets("Forecast").Range("P7").Value <> Target.Value Then
Sheets("Forecast").Range("P7").Value = Target.Value
End If
End If
End If


If Not Intersect(Target, Range("p8")) Is Nothing Then
If Target = Range("p8") Then


If Sheets("Forecast").Range("p8").Value <> Target.Value Then
Sheets("Forecast").Range("p8").Value = Target.Value
End If
End If
End If


If Not Intersect(Target, Range("p9")) Is Nothing Then
If Target = Range("p9") Then


If Sheets("Forecast").Range("p9").Value <> Target.Value Then
Sheets("Forecast").Range("p9").Value = Target.Value
End If
End If
End If


and so on for many cells in the P column then the same for other columns. can this be cleaned up so i dont have to list each cell. can i set a range ??
 
Upvote 0
Try
Code:
Private Sub Worksheet_change(ByVal Target As Range)

If Not Intersect(Target, Range("P5:P10")) Is Nothing Then
   Sheets("Forecast").Range(Target.Address).Value = Target.Value
End If
End Sub
 
Upvote 0
Try
Code:
Private Sub Worksheet_change(ByVal Target As Range)

If Not Intersect(Target, Range("P5:P10")) Is Nothing Then
   Sheets("Forecast").Range(Target.Address).Value = Target.Value
End If
End Sub

OK thank you, this worked for the Forecast sheet. I am trying to rewrite the below code similar to what you just sent and accomplish a 2 way mirror on another sheet in this workbook. the code i originally had looked like this. I am having trouble writing the piece that confirms if the target cell <> does not equal the current value

see below:

Code:
Private Sub Worksheet_change(ByVal Target As Range)
 
If Not Intersect(Target, Range("p5")) Is Nothing Then
  If Target = Range("p5") Then


    If Sheets("Forecast").Range("p5").Value <> Target.Value Then
     Sheets("Forecast").Range("p5").Value = Target.Value
    End If
  End If
End If


 If Not Intersect(Target, Range("p6")) Is Nothing Then
  If Target = Range("p6") Then


    If Sheets("Forecast").Range("p6").Value <> Target.Value Then
     Sheets("Forecast").Range("p6").Value = Target.Value
    End If
  End If
End If


 If Not Intersect(Target, Range("P7")) Is Nothing Then
  If Target = Range("P7") Then


    If Sheets("Forecast").Range("P7").Value <> Target.Value Then
     Sheets("Forecast").Range("P7").Value = Target.Value
    End If
  End If
End If


If Not Intersect(Target, Range("p8")) Is Nothing Then
  If Target = Range("p8") Then


    If Sheets("Forecast").Range("p8").Value <> Target.Value Then
     Sheets("Forecast").Range("p8").Value = Target.Value
    End If
  End If
End If


 If Not Intersect(Target, Range("p9")) Is Nothing Then
  If Target = Range("p9") Then


    If Sheets("Forecast").Range("p9").Value <> Target.Value Then
     Sheets("Forecast").Range("p9").Value = Target.Value
    End If
  End If
End If


 If Not Intersect(Target, Range("P10")) Is Nothing Then
  If Target = Range("P10") Then


    If Sheets("Forecast").Range("P10").Value <> Target.Value Then
     Sheets("Forecast").Range("P10").Value = Target.Value
    End If
  End If
End If


If Not Intersect(Target, Range("p11")) Is Nothing Then
  If Target = Range("p11") Then


    If Sheets("Forecast").Range("p11").Value <> Target.Value Then
     Sheets("Forecast").Range("p11").Value = Target.Value
    End If
  End If
End If
 
Last edited by a moderator:
Upvote 0
Why do you need the check?
If the values don't match you copy it over, if it does match, then you might as well copy it over anyway.
 
Upvote 0

Forum statistics

Threads
1,224,619
Messages
6,179,924
Members
452,949
Latest member
beartooth91

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