Delete Right 5 if

E

Esrei

I need a macro to do the following in B3:B500
If(right(......,5)="Total"
Delete Right(........,6)

Hope this is clear
 
S

Stefi

You not necessarily need a macro, the following formula in a helper column
does the job:
=IF(RIGHT(B3;5)="Total";MID(B3;1;LEN(B3)-6);B3)

Regards,
Stefi

„Esrei†ezt írta:
 
D

Duke Carey

You don't need a mcro, just insert a new column next to column B
In row 3 of the new column, use this formula, and copy it down to row 500

=IF(RIGHT(B3,5)="TOTAL",LEFT(B3,LEN(B3)-6),B3)

AFter you have copied it all the way down, copy the results, select cell B3,
and use Edit->Paste Special-> VAlues. Then delete the column with the
formulas
 
D

Don Guillett

something like

for each c in selection
if right(c,5)="Total" then c.value=left(c,len(c)-5)
next
 
Top