Link to home
Start Free TrialLog in
Avatar of Jesper E Magnussen
Jesper E MagnussenFlag for Norway

asked on

Remove a right side 8 character string from a column of data

Hi,

Have Excel 2016 workbook, With an Entity Volume (here in column "C" sometimes other columns), problem is that the software I got the data from have added string " cubic m" to the values and to sum up the data in the column I need to remove the added string With a click of a button. How do I get round that?
Avatar of aikimark
aikimark
Flag of United States of America image

Edit Find/Replace (Ctrl+H)
Avatar of Jesper E Magnussen

ASKER

Hi thanks,

Would love a bit of VBA code or macro that would do the trick.
The following VBA code will remove cubic m anywhere on the current worksheet.
    Cells.Select
    Selection.Replace What:="cubic m", Replacement:="", LookAt:=xlPart
    Range("A1").Select

Open in new window

Thank's Sam,

What would a Macro that would Call this code look like, to be used in any workbook?
ASKER CERTIFIED SOLUTION
Avatar of Sam Jacobs
Sam Jacobs
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You probably know this, but just in case, to put Sam's code in a macro the macro would look something like this.

Sub RemoveCubicM
Cells.Select
Selection.Replace What:="cubic m", Replacement:="", LookAt:=xlPart
Range("A1").Select
End Sub

Open in new window