Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy contents of Find (Find and Replace) | Excel Discussion (Misc queries) | |||
Find in XML and Copy | Excel Discussion (Misc queries) | |||
Find and Copy | Excel Discussion (Misc queries) | |||
Find and Copy | Excel Programming | |||
find and copy | Excel Worksheet Functions |