maximejeanlouis
New Member
- Joined
- Aug 19, 2015
- Messages
- 7
Private Sub CommandButton1_Click()
'Declare variables
Dim I, LastRow, MLastRow
'Locate LastRow value
LastRow = ActiveSheet.Range("A" & Rows.count).End(xlUp).Row
For I = 2 To LastRow
If Cells(I, 1) > 0 Then
Range(Cells(I, 1), Cells(I, 30)).Select
Selection.Copy
Workbooks.Open Filename:="C:\Users\maxim\Desktop\6-27 Magento Process\Magento Invoices1.xlsm"
Dim p As Integer, q As Integer
p = Worksheets.count
For q = 1 To p
If ActiveWorkbook.Worksheets(q).Name = "Magento Invoice Master" Then
Worksheets("Magento Invoice Master").Select
End If
Next q
MLastRow = ActiveSheet.Cells(Rows.count, 1).End(xlUp).Offset(1, 0).Row
ActiveSheet.Cells(MLastRow, 1).Select
ActiveSheet.Paste
ActiveWorkbook.Save
'ActiveWOrkbook.Close
Application.CutCopyMode = False
End If
Next I
End Sub
'Declare variables
Dim I, LastRow, MLastRow
'Locate LastRow value
LastRow = ActiveSheet.Range("A" & Rows.count).End(xlUp).Row
For I = 2 To LastRow
If Cells(I, 1) > 0 Then
Range(Cells(I, 1), Cells(I, 30)).Select
Selection.Copy
Workbooks.Open Filename:="C:\Users\maxim\Desktop\6-27 Magento Process\Magento Invoices1.xlsm"
Dim p As Integer, q As Integer
p = Worksheets.count
For q = 1 To p
If ActiveWorkbook.Worksheets(q).Name = "Magento Invoice Master" Then
Worksheets("Magento Invoice Master").Select
End If
Next q
MLastRow = ActiveSheet.Cells(Rows.count, 1).End(xlUp).Offset(1, 0).Row
ActiveSheet.Cells(MLastRow, 1).Select
ActiveSheet.Paste
ActiveWorkbook.Save
'ActiveWOrkbook.Close
Application.CutCopyMode = False
End If
Next I
End Sub