Remove part of cell contents

Damo10

Active Member
Joined
Dec 13, 2010
Messages
460
Hi,

I need some VBA code that will look at all populated cells in column I and remove from the contents the brackets, the contents inside them and the space to the left and leave the rest, the bracketed information is always on the end of the contents but the contents inside does change.

Example

STRAWBERRY (10KG) to STRAWBERRY

Regards
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Hi VoG,

Thanks for your reply but I need to do this via code and the cell contents vary in length and there are some that dont have the bracketed info on the end.

Regards
 
Upvote 0
Try

Code:
Sub test()
Dim LR As Long, i As Long, j As Long
LR = Range("I" & Rows.Count).End(xlUp).Row
For i = 1 To LR
    With Range("I" & i)
        j = InStr(.Value, "(")
        If j > 0 Then
            .Value = Left(.Value, j - 2)
        End If
    End With
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,532
Messages
6,179,388
Members
452,908
Latest member
MTDelphis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top