Boulder2008
New Member
- Joined
- Jun 29, 2018
- Messages
- 4
Hello,
I am currently trying to write a macro that will take a shifts daily output and place it in a daily log that will be progressively kept through the year.
The workbook submitted by my Supervisors has the date, a shift drop down with selections (1ST, 2ND, 3RD) and four different products. Once they fill this out and click on the "Submit" button I would like the macro to copy the relevant data into the correct Shift and Date location in my second workbook. I am not sure how to ensure that the data is copied into the correct shift and date since every day it will need to be indexed to a new spot and we dont always run on the weekend and we dont always run all 3 shifts a day.
I messed around with the "Private Sub Worksheet_Change(ByVal Target As Range) for the drop down list, but had no luck in getting that version of code to work. I appreciate any assistance I can get regarding this issue.
My current code is:
<colgroup><col span="2"><col><col><col span="2"></colgroup><tbody>
</tbody>
I am currently trying to write a macro that will take a shifts daily output and place it in a daily log that will be progressively kept through the year.
The workbook submitted by my Supervisors has the date, a shift drop down with selections (1ST, 2ND, 3RD) and four different products. Once they fill this out and click on the "Submit" button I would like the macro to copy the relevant data into the correct Shift and Date location in my second workbook. I am not sure how to ensure that the data is copied into the correct shift and date since every day it will need to be indexed to a new spot and we dont always run on the weekend and we dont always run all 3 shifts a day.
I messed around with the "Private Sub Worksheet_Change(ByVal Target As Range) for the drop down list, but had no luck in getting that version of code to work. I appreciate any assistance I can get regarding this issue.
My current code is:
Sub TransferData() Dim WkBk As Workbook Dim SrcWkBk As Workbook Set SrcWkBk = ThisWorkbook Set WkBk = Workbooks.Open(Filename:="INSERT FILE NAME.xlsm") 'Copy Total Number of Parts per Line SrcWkBk.Sheets("Hourly Counts").Range("P4").Copy WkBk.Worksheets("Sheet1").Range("C2").PasteSpecial Paste:=xlPasteValues SrcWkBk.Sheets("Hourly Counts").Range("P6").Copy WkBk.Worksheets("Sheet1").Range("C5").PasteSpecial Paste:=xlPasteValues WkBk.SaveAs ("C:\INSERT FILE LOCATION" & Format(Date, "MM-DD-YYYY") & ".xlsm") 'Clear Clipboard Application.CutCopyMode = False End Sub | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
My log file looks like:
<tbody> </tbody> |
<colgroup><col span="2"><col><col><col span="2"></colgroup><tbody>
</tbody>