I have an excel file that contains a macro that is used to clean up a bunch of csv files.
after I run the macro, I keep the csv file open, then I would use this userform to copy data from the excel that contains the macro to the csv
when I select 1250, qty of 1, these data are copied to the csv after the last active row, if qty is 2, then these are copied to the csv twice
code below, when I click process, nothing happened. I must be missing something basic...
after I run the macro, I keep the csv file open, then I would use this userform to copy data from the excel that contains the macro to the csv
when I select 1250, qty of 1, these data are copied to the csv after the last active row, if qty is 2, then these are copied to the csv twice
code below, when I click process, nothing happened. I must be missing something basic...
VBA Code:
Private Sub Process_Click()
Dim wb1 As Workbook
Dim wb2 As Workbook
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim lastRow As Long
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open(FileName)
Set ws1 = wb1.Sheets("Sheet1")
Set ws2 = ActiveSheet
lastRow = ws2.Cells(ws2.Rows.Count, "A").End(xlUp).Row
If Me.GTSize1.Value = "1250 gallon" Then
ws1.Range("B51:K56").Copy
ws2.Range("A" & lastRow + 1).PasteSpecial xlPasteAll
End If
End Sub