Hello,
This is my first time posting. Everyday my operators collect data and save them as a WB with the date as the name. I have created a "Master" WB where I copy and store only specific cells from the operator's WBs. Due to the nature of the formatting in the WBs I need to constantly go back and forth copying and pasting the items I need. I've come up with a code to copy and paste the specific cells I need, but I have to manually activate the operators workbook every time I need to copy any items after the first items have been copied and pasted. Here is what I have so far.
Sub CopyToMaster()
Windows("Today's Date.xlsm").Activate <--- [I've changed this line to "ActiveWindow.Activate" to allow me to reference the WB I have open currently]
Range("P5:P6").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Master List.xlsm").Activate
Range("A" & Rows.Count).End(xlUp).Offset(1).Select <--- [I am using this to paste items into the next blank row]
Selection.Paste
Windows("Today's Date.xlsm").Activate
Range("P7:P8").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Master List.xlsm").Activate
Range("C" & Rows.Count).End(xlUp).Offset(1).Select
ActiveSheet.Paste
Windows("Today's Date.xlsm").Activate
Range("P9:P10").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Master List.xlsm").Activate
Range("E" & Rows.Count).End(xlUp).Offset(1).Select
ActiveSheet.Paste
Windows("Today's Date.xlsm").Activate
Range("P11:P12").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Master List.xlsm").Activate
Range("G" & Rows.Count).End(xlUp).Offset(1).Select
ActiveSheet.Paste
End Sub
Is there a way for excel to "remember" the active workbook I copied from the first time (The one in the first line of the code), activate it and copy/paste the items I need automatically? I can't keep it referenced as "Today's Date" as that is the variable that keeps changing. I hope this is detailed enough. I am sorry if there is a problem with the way I am posting this, I am very new to all this, just started today! Any help will be much appreciated! Thanks in advance!
This is my first time posting. Everyday my operators collect data and save them as a WB with the date as the name. I have created a "Master" WB where I copy and store only specific cells from the operator's WBs. Due to the nature of the formatting in the WBs I need to constantly go back and forth copying and pasting the items I need. I've come up with a code to copy and paste the specific cells I need, but I have to manually activate the operators workbook every time I need to copy any items after the first items have been copied and pasted. Here is what I have so far.
Sub CopyToMaster()
Windows("Today's Date.xlsm").Activate <--- [I've changed this line to "ActiveWindow.Activate" to allow me to reference the WB I have open currently]
Range("P5:P6").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Master List.xlsm").Activate
Range("A" & Rows.Count).End(xlUp).Offset(1).Select <--- [I am using this to paste items into the next blank row]
Selection.Paste
Windows("Today's Date.xlsm").Activate
Range("P7:P8").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Master List.xlsm").Activate
Range("C" & Rows.Count).End(xlUp).Offset(1).Select
ActiveSheet.Paste
Windows("Today's Date.xlsm").Activate
Range("P9:P10").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Master List.xlsm").Activate
Range("E" & Rows.Count).End(xlUp).Offset(1).Select
ActiveSheet.Paste
Windows("Today's Date.xlsm").Activate
Range("P11:P12").Select
Application.CutCopyMode = False
Selection.Copy
Windows("Master List.xlsm").Activate
Range("G" & Rows.Count).End(xlUp).Offset(1).Select
ActiveSheet.Paste
End Sub
Is there a way for excel to "remember" the active workbook I copied from the first time (The one in the first line of the code), activate it and copy/paste the items I need automatically? I can't keep it referenced as "Today's Date" as that is the variable that keeps changing. I hope this is detailed enough. I am sorry if there is a problem with the way I am posting this, I am very new to all this, just started today! Any help will be much appreciated! Thanks in advance!