J
Jon C
Hi, I'm trying to build a spreadsheet, in VBA, based on timesheet data. I'd
like a total of time spent on each task. The task list can change so the
first job is to define all unique tasks. I've used the following:
Sheets("Detail").Columns("E:E").AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Range("A1"), Unique:=True
Works fine. The problem comes when I try and automatically copy down the
formulas I want to use on each row against each task description. I started
with this:
Dim lLastRow As Long
lLastRow = Sheets("Monthly
Summary").Cells.SpecialCells(xlCellTypeLastCell).Row
Debug.Print "lLastRow = " & lLastRow
Worksheets("Monthly Summary").Activate
Range("B2:N2").Select
Selection.AutoFill Destination:=Sheets("Monthly Summary").Range("B2:N" &
lLastRow - 1), Type:=xlFillDefault
The problem I face is that on my destination sheet I can only 'see' thirty
or so tasks but lLastRow reports 440 with nothing 'visible' in cells 31 to
440! Hence, my copy down goes on way beyond where I need it to finish.
Any suggestions please?
Thanks,
Jon C
p.s. I know pivots would be an ideal approach but there are downstream
limitations to using them here.
like a total of time spent on each task. The task list can change so the
first job is to define all unique tasks. I've used the following:
Sheets("Detail").Columns("E:E").AdvancedFilter Action:=xlFilterCopy, _
CopyToRange:=Range("A1"), Unique:=True
Works fine. The problem comes when I try and automatically copy down the
formulas I want to use on each row against each task description. I started
with this:
Dim lLastRow As Long
lLastRow = Sheets("Monthly
Summary").Cells.SpecialCells(xlCellTypeLastCell).Row
Debug.Print "lLastRow = " & lLastRow
Worksheets("Monthly Summary").Activate
Range("B2:N2").Select
Selection.AutoFill Destination:=Sheets("Monthly Summary").Range("B2:N" &
lLastRow - 1), Type:=xlFillDefault
The problem I face is that on my destination sheet I can only 'see' thirty
or so tasks but lLastRow reports 440 with nothing 'visible' in cells 31 to
440! Hence, my copy down goes on way beyond where I need it to finish.
Any suggestions please?
Thanks,
Jon C
p.s. I know pivots would be an ideal approach but there are downstream
limitations to using them here.