03856me
Active Member
- Joined
- Apr 4, 2008
- Messages
- 297
I have these three macros that run and they work perfectly if I include the message box - like the message box clears the previous macro event. The macros are splitting one row of data to 3 separate rows on another worksheet. Can someone help with what I need to include rather than a message box? I know their is probably a more efficient way to do this but this is my last day of work and I need it fixed quickly.
VBA Code:
Sub CopyDollarsEtc()
SubTotalCopy
GSTCopy
TotalCopy
End Sub
'=== Sub Total ===============================================
Sub SubTotalCopy()
Dim wb As Workbook
Set wb = ThisWorkbook
Dim wsTo As Worksheet
Set wsTo = wb.Sheets("upload")
Dim wsFrom As Worksheet
Set wsFrom = wb.Sheets("Sheet1")
wsFrom.Range("B5:B5000").Copy wsTo.Range("D2") 'VendorID
wsFrom.Range("C5:C5000").Copy wsTo.Range("E2") 'InvoiceNumber
wsFrom.Range("E5:E5000").Copy wsTo.Range("L2") 'Account
wsFrom.Range("J5:J5000").Copy wsTo.Range("F2") 'Total Amount
wsFrom.Range("F5:F5000").Copy wsTo.Range("M2") 'Sub-Total Amount
MsgBox "Sub-Totals Copied"
End Sub
'=== GST =====================================================
Sub GSTCopy()
Dim wb As Workbook
Set wb = ThisWorkbook
Dim wsTo As Worksheet
Set wsTo = wb.Sheets("upload")
Dim wsFrom As Worksheet
Set wsFrom = wb.Sheets("Sheet1")
Dim glastRow As Long
glastRow = Range("D" & Rows.Count).End(xlUp).Row + 1
wsFrom.Range("B5:B5000").Copy wsTo.Range("D" & glastRow) 'VendorID
wsFrom.Range("C5:C5000").Copy wsTo.Range("E" & glastRow) 'InvoiceNumber
wsFrom.Range("L5:L5000").Copy wsTo.Range("L" & glastRow) 'Account
wsFrom.Range("J5:J5000").Copy wsTo.Range("F" & glastRow) 'Total Amount
wsFrom.Range("G5:G5000").Copy wsTo.Range("M" & glastRow) 'GST Amount
MsgBox "GST Copied"
End Sub
'=== TOTAL ===================================================
Sub TotalCopy()
Dim wb As Workbook
Set wb = ThisWorkbook
Dim wsTo As Worksheet
Set wsTo = wb.Sheets("upload")
Dim wsFrom As Worksheet
Set wsFrom = wb.Sheets("Sheet1")
Dim tlastRow As Long
tlastRow = Range("D" & Rows.Count).End(xlUp).Row + 1
wsFrom.Range("B5:B5000").Copy wsTo.Range("D" & tlastRow) 'VendorID
wsFrom.Range("C5:C5000").Copy wsTo.Range("E" & tlastRow) 'InvoiceNumber
wsFrom.Range("D5:D5000").Copy wsTo.Range("L" & tlastRow) 'Account
wsFrom.Range("J5:J5000").Copy wsTo.Range("F" & tlastRow) 'Total Amount
wsFrom.Range("G5:G5000").Copy wsTo.Range("M" & tlastRow) 'Invoice Total
MsgBox "Totals Copied"
End Sub