I’m hoping to get some help from a guru. I need to cut from one work sheet and paste to another with the click of a button without over writing data. I have code below that is working great but only partially doing this. I need to go much further, possibly using loops and if statements for conditions to be set?
I have two work books:
Tracker.xlsm / SalesTracker: consists of: products, product codes and account numbers. It is filled out daily with many different sales per day at different times of the day.
TrackerReports.xlsm: record keeping for all sales with product codes and account numbers for entire year.
This is what the end project will hopefully look like.
Tracker Reports: http://jbmcd.com/UpSalesTracking/TrackerReports.xlsm or http://jbmcd.com/UpSalesTracking/TrackerReports.jpg
Tracker: http://jbmcd.com/UpSalesTracking/Tracker.xlsm or http://jbmcd.com/UpSalesTracking/Tracker.jpg
Tracker.xlsm / SalesTracker :
I have two work books:
Tracker.xlsm / SalesTracker: consists of: products, product codes and account numbers. It is filled out daily with many different sales per day at different times of the day.
TrackerReports.xlsm: record keeping for all sales with product codes and account numbers for entire year.
This is what the end project will hopefully look like.
Tracker Reports: http://jbmcd.com/UpSalesTracking/TrackerReports.xlsm or http://jbmcd.com/UpSalesTracking/TrackerReports.jpg
Tracker: http://jbmcd.com/UpSalesTracking/Tracker.xlsm or http://jbmcd.com/UpSalesTracking/Tracker.jpg
Tracker.xlsm / SalesTracker :
- Macro assigned to a button
- Cut/copy Column A and column B, rows 1 to 12 from Tracker.xlsm / SalesTracker
- Delete data in column A, not delete A3
- Paste all data from column A and B to TrackerReports.xlsm / sheet2
(I have code for the above working properly but not for the below criteria).
- Paste by date of the columns.
- 12 tabs/sheets for each month of the year.
- Laid out in columns
- Row 1 has 31 merged cells with date (each day of the month).
- Two columns under each date. One column for product code, second column for product sold.
- Pasting will be according to today’s date, data pasted from Tracker.xlsm / SalesTracker will be pasted in both columns under today’s date.
- Pasted data can not overwrite previously pasted data.
This is the code I have so far and it working fine but not doing everything I need to do:
Private Sub CommandButton1_Click()
Dim LastRw As Long
LastRw = Sheets("Sheet2").UsedRange.Rows.Count
Sheets("Sheet2").Cells(LastRw + 1, "A").Value = Sheets("Sheet1").TextBoxes("TextBox 1").Text
Sheets("Sheet2").Cells(LastRw + 1, "B").Value = Sheets("Sheet1").TextBoxes("TextBox 2").Text
Sheets("Sheet2").Cells(LastRw + 1, "C").Value = TimeValue(Now)
End Sub
Sub CutPaste()
'
' CutPaste Macro
'
'
Range("A1:B12").Select
Selection.Copy
Windows("TrackerReports.xlsm").Activate
Range("A2:B13").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Windows("Tracker.xlsm").Activate
Range("A2").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("A4:A12").Select
Selection.ClearContents
Range("A2").Select
End Sub