Can anyone recommend a good video for me about this Excel VBA problem
I have a Master workbook with a few thousand rows. Based on the value in Column 2, I need to copy each row to one of 10 different workbooks.
So far I have found only this video: http://www.familycomputerclub.com/copy-data-to-another-workbook-based-on-sales-date.html
It has been helpful but it has not enabled me to get all the way there.
Can anyone recommend a good video that will walk through this with me. I am looking for a video so I understand what I am doing, rather than just copying and pasting code.
Thank you!
Here is what I have so far. The issue is that with the below code, for every row that needs to be copy and pasted... the new copy-to workbook opens, saves, and closes. So if there are 30 rows in the Master workbook that meet the criteria to be copied into the copy-to workbook... with each row it is
- copy row from master workbook
- open copy-to workbook
- paste in copy-to workbook
- save copy-to workbook
- close copy-to workbook
Code:
Sub updateAllWorkbooks()
a = Worksheets("All").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To a
If Worksheets("All").Cells(i, 2).Value = "DENVER" Then
Worksheets("All").Rows(i).Copy
Workbooks.Open Filename:="FILE NAME IS PASTED HERE"
Worksheets("DENVER").Activate
b = Worksheets("DENVER").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("DENVER").Cells(b + 1, 1).Select
ActiveSheet.Paste
ActiveWorkbook.Save
ActiveWorkbook.Close
Application.CutCopyMode = False
Worksheets("All").Activate
End If
Next
Application.CutCopyMode = False
ThisWorkbook.Worksheets("All").Cells(1, 1).Select
End Sub