diadromous
New Member
- Joined
- Feb 4, 2014
- Messages
- 2
Hello -
I have a database that needs breaking down in order to fulfill a request.
I've been trying to create a macro to copy one row to a new workbook (starting from row 3), file name save as a value of the cell (C1), and move onto the next row. However, my code appears to only loop through 26 entries and then stops.
Is there something I am doing wrong? Any help would be a HUGE help!
I have a database that needs breaking down in order to fulfill a request.
I've been trying to create a macro to copy one row to a new workbook (starting from row 3), file name save as a value of the cell (C1), and move onto the next row. However, my code appears to only loop through 26 entries and then stops.
Code:
Dim row As Long
Dim refname
row = 3
Do While Cells(row).Value <> ""
Rows(row).Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
Application.CutCopyMode = False
DirPath = MyPath
refname = ActiveSheet.Range("C1")
ActiveWorkbook.SaveAs DirPath & refname
ActiveWindow.Close
row = row + 1
Loop
Is there something I am doing wrong? Any help would be a HUGE help!