![]() |
find last row, copy until end
Hi Folks,
I have data that is pasted into column "A" from a macro. The macro first deletes all data from the sheet ("Totals"), then runs a db query on another sheet ("Receives"), subtotals, then copies the subtotals back to the original sheet ("Totals"). that rage will always be dynamic and contain a differing number of rows, but will always contain the word 'Total' at the end of each value in column "A". I would like the macro, once the new values are copied, to find the last row, and remove the last 6 characters from each value in column "A". I'm stuck on the finding last row, then looping through non empty rows and trimming the string... customer 1 Total -should become- customer 1 customer name 2 Total -should become- customer name 2 ....and so on. Each value in column "A" will be of a variable length, and removing the word 'Total' and the preceding space will solve my problem. TIA! |
find last row, copy until end
Stephen what about using the Replace method on column A and replacing "
Total" with ""? Range("A:A").Replace What:=" Total", Replacement:="", LookAt:=xlPart, _ SearchOrder:=xlByColumns, MatchCase:=True, SearchFormat:=False, _ ReplaceFormat:=False -- Charles Chickering "A good example is twice the value of good advice." "Stephen" wrote: Hi Folks, I have data that is pasted into column "A" from a macro. The macro first deletes all data from the sheet ("Totals"), then runs a db query on another sheet ("Receives"), subtotals, then copies the subtotals back to the original sheet ("Totals"). that rage will always be dynamic and contain a differing number of rows, but will always contain the word 'Total' at the end of each value in column "A". I would like the macro, once the new values are copied, to find the last row, and remove the last 6 characters from each value in column "A". I'm stuck on the finding last row, then looping through non empty rows and trimming the string... customer 1 Total -should become- customer 1 customer name 2 Total -should become- customer name 2 ...and so on. Each value in column "A" will be of a variable length, and removing the word 'Total' and the preceding space will solve my problem. TIA! |
find last row, copy until end
THAT'S FANTASTIC!!!!!
Thank you very much! "Charles Chickering" wrote: Stephen what about using the Replace method on column A and replacing " Total" with ""? Range("A:A").Replace What:=" Total", Replacement:="", LookAt:=xlPart, _ SearchOrder:=xlByColumns, MatchCase:=True, SearchFormat:=False, _ ReplaceFormat:=False -- Charles Chickering "A good example is twice the value of good advice." "Stephen" wrote: Hi Folks, I have data that is pasted into column "A" from a macro. The macro first deletes all data from the sheet ("Totals"), then runs a db query on another sheet ("Receives"), subtotals, then copies the subtotals back to the original sheet ("Totals"). that rage will always be dynamic and contain a differing number of rows, but will always contain the word 'Total' at the end of each value in column "A". I would like the macro, once the new values are copied, to find the last row, and remove the last 6 characters from each value in column "A". I'm stuck on the finding last row, then looping through non empty rows and trimming the string... customer 1 Total -should become- customer 1 customer name 2 Total -should become- customer name 2 ...and so on. Each value in column "A" will be of a variable length, and removing the word 'Total' and the preceding space will solve my problem. TIA! |
All times are GMT +1. The time now is 07:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com