ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Recording a Macro that follows Keystrokes (https://www.excelbanter.com/excel-discussion-misc-queries/157247-recording-macro-follows-keystrokes.html)

freakyquo

Recording a Macro that follows Keystrokes
 
Hello,
I have a column of descriptions which all end in "Total" - (I did a subtotal
and copied the results into another worksheet.).
I tried recording a Macro to delete the "Total", but for every cell below
the first it just copied what I had done in the first cell.

Is there a way I can get rid of the "Total" at the end, without having to
manually go through all 26,000 lines?

Thanks




Gary''s Student

Recording a Macro that follows Keystrokes
 
Select the cells and run:

Sub nototal()
For Each r In Selection
r.Value = Replace(r.Value, "Total", "")
Next
End Sub

--
Gary''s Student - gsnu200743


"freakyquo" wrote:

Hello,
I have a column of descriptions which all end in "Total" - (I did a subtotal
and copied the results into another worksheet.).
I tried recording a Macro to delete the "Total", but for every cell below
the first it just copied what I had done in the first cell.

Is there a way I can get rid of the "Total" at the end, without having to
manually go through all 26,000 lines?

Thanks




Dave Peterson

Recording a Macro that follows Keystrokes
 
How about selecting the range
Edit|replace
what: Total
with: (leave blank)
replace all

But you may have _Total (spacebar total). You may want to get rid of " total",
not just "total".

If you need a macro, record one when you select the column and do the
edit|Replace.

freakyquo wrote:

Hello,
I have a column of descriptions which all end in "Total" - (I did a subtotal
and copied the results into another worksheet.).
I tried recording a Macro to delete the "Total", but for every cell below
the first it just copied what I had done in the first cell.

Is there a way I can get rid of the "Total" at the end, without having to
manually go through all 26,000 lines?

Thanks


--

Dave Peterson

freakyquo

Recording a Macro that follows Keystrokes
 
Thanks, that worked a treat

"Gary''s Student" wrote:

Select the cells and run:

Sub nototal()
For Each r In Selection
r.Value = Replace(r.Value, "Total", "")
Next
End Sub

--
Gary''s Student - gsnu200743


"freakyquo" wrote:

Hello,
I have a column of descriptions which all end in "Total" - (I did a subtotal
and copied the results into another worksheet.).
I tried recording a Macro to delete the "Total", but for every cell below
the first it just copied what I had done in the first cell.

Is there a way I can get rid of the "Total" at the end, without having to
manually go through all 26,000 lines?

Thanks





All times are GMT +1. The time now is 07:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com