code to add to each cell

methody

Well-known Member
Joined
Jun 17, 2002
Messages
857
Hi
I have a column with changeable number of non empty cells, although the whole column might be blank. Each cell contains some text (unless the whole column is blank). There are no empty cells. I am looking for code which will look at the column and as long as the column is no blank, it will look at each cell and add (2). So if the cell initially has 'ABX33' if will subsequently have 'ABX33(2)'
I know it could be done with formulas but I want to avoid using formulas.

Any help would be appreciated
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
VBA Code:
    Dim Rng As Range
    If ActiveSheet.Range("A2") <> "" Then
        Set Rng = ActiveSheet.Range("A2:A" & ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row)
        For Each r In Rng
            r.Value = r.Value & "(2)"
        Next
    End If
 
Upvote 0
Solution

Forum statistics

Threads
1,215,444
Messages
6,124,893
Members
449,194
Latest member
JayEggleton

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