ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Parse Data - Code form Don G. (https://www.excelbanter.com/excel-programming/395393-parse-data-code-form-don-g.html)

Steve[_4_]

Parse Data - Code form Don G.
 
Don,
Thanks for the code. But looks like the code creates the sheets, but
does not copy any data
to them. Looks like the variable dlr is always "empty", and since its
part of the copy to range, never pastes. Any ideas what went wrong?
Thanks!

Sub CopyDaily()

Application.ScreenUpdating = False

With Sheets("Data")
lr = .Cells(Rows.Count, "a").End(xlUp).Row
..Range("A1:A" & lr).AdvancedFilter Action:=xlFilterInPlace,
Unique:=True
For Each c In .Range("a2:a" & lr).SpecialCells(xlVisible)
On Error Resume Next
If Worksheets(c.Value) Is Nothing Then
Worksheets.Add(after:=Worksheets(Worksheets.Count) ).Name = c
End If
.ShowAllData
.Range("a1:a" & lr).AutoFilter field:=1, Criteria1:=c
dlr = Sheets(c.Value).Cells(Rows.Count, "a").End(xlUp).Row + 1
.Range("a2:a" & lr).Copy Sheets(c.Value).Range("a" & dlr)
Next c
.ShowAllData
.Range("a1:a" & lr).AutoFilter
End With

Application.ScreenUpdating = True

End Sub



All times are GMT +1. The time now is 05:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com