View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Steve[_4_] Steve[_4_] is offline
external usenet poster
 
Posts: 184
Default 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