M
mcescher
I have about 40k rows of info in a sheet. This goes to VP level
people. Now, they want the location specific information (25
locations) to go to the managers of those locations. So, I have to
make 25 copies of the book, and delete all the rows that don't go to
that location in each book.
So, I cycle through the rows, checking the manager and clearing the
row if it doesn't belong. Then I sort the remaining records to the
top. This works fine, I'm just wondering if there is a more efficient
(speedier) way to do this. FWIW, I'm doing this from MS Access 2003
strPathDest = strBIExt & "\InforceList" & strFileDate & "_" & !
SalesMgrFileName & ".xls"
FileCopy strPathSrc, strPathDest
Set xlBook = xlApp.Workbooks.Open(strPathDest)
'Grab Inforce and clean it out
Set xlSheet = xlBook.Worksheets("Inforce")
xlSheet.Activate
intRow = 2
Do While xlSheet.Range(R1C1toA1(intRow, 18)).Value > ""
If xlSheet.Range(R1C1toA1(intRow, 18)).Value <> !
SalesMgrXLName Then
Rows(intRow).Select
Selection.ClearContents
End If
intRow = intRow + 1
Loop
Rows("2:65536").Select
Selection.Sort Key1:=Range("C1"), Order1:=xlAscending,
Header:=xlYes
Range("A2").Select
people. Now, they want the location specific information (25
locations) to go to the managers of those locations. So, I have to
make 25 copies of the book, and delete all the rows that don't go to
that location in each book.
So, I cycle through the rows, checking the manager and clearing the
row if it doesn't belong. Then I sort the remaining records to the
top. This works fine, I'm just wondering if there is a more efficient
(speedier) way to do this. FWIW, I'm doing this from MS Access 2003
strPathDest = strBIExt & "\InforceList" & strFileDate & "_" & !
SalesMgrFileName & ".xls"
FileCopy strPathSrc, strPathDest
Set xlBook = xlApp.Workbooks.Open(strPathDest)
'Grab Inforce and clean it out
Set xlSheet = xlBook.Worksheets("Inforce")
xlSheet.Activate
intRow = 2
Do While xlSheet.Range(R1C1toA1(intRow, 18)).Value > ""
If xlSheet.Range(R1C1toA1(intRow, 18)).Value <> !
SalesMgrXLName Then
Rows(intRow).Select
Selection.ClearContents
End If
intRow = intRow + 1
Loop
Rows("2:65536").Select
Selection.Sort Key1:=Range("C1"), Order1:=xlAscending,
Header:=xlYes
Range("A2").Select