Groundrush
Registered User.
- Local time
- Today, 11:21
- Joined
- Apr 14, 2002
- Messages
- 1,376
What is the best way to copy & paste without worrying about missing out records when using a macro?
I thought I sussed this out awhile ago but It seems that I'm still doing this incorrectly.
I have a large spreadsheet that has in average increase of about 260 records per week. At the moment it stands at 6544 records & I have till April next year for the spreadsheet to reach it's maximum record count.
The records are divided into 14 different contracts, Contract being the filtered field
I use this code to filter, copy then paste before moving onto the next filtered contract
The problem I have is that each week when the records increase the range will be incorrect & some records will be missed.
I guess I need a way to find the last record & select the whole range?
any Ideas?
thanks
I thought I sussed this out awhile ago but It seems that I'm still doing this incorrectly.
I have a large spreadsheet that has in average increase of about 260 records per week. At the moment it stands at 6544 records & I have till April next year for the spreadsheet to reach it's maximum record count.
The records are divided into 14 different contracts, Contract being the filtered field
I use this code to filter, copy then paste before moving onto the next filtered contract
Code:
Selection.AutoFilter
''Select Admin Contract, copy & paste into correct tab ready for summing up costs
Selection.AutoFilter Field:=1, Criteria1:="Admin Buildings"
Range("A1:R6545").Select
Range("A2").Activate
''save space
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets("Adm").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
ActiveWindow.Panes(1).Activate
Cells.Select
''save space
Selection.SpecialCells(xlCellTypeVisible).Select
Cells.EntireColumn.AutoFit
Sheets("All").Select
Application.CutCopyMode = False
The problem I have is that each week when the records increase the range will be incorrect & some records will be missed.
I guess I need a way to find the last record & select the whole range?
any Ideas?
thanks