How to add a letter to an existing cell with a number?

singlefin

New Member
Joined
Oct 2, 2006
Messages
8
Hi,

I want to add a letter (any letter) to cells in my worksheets that have manually entered numbers, which I have been able to highlight with the following code.

But I want to add a letter in front of whatever number that is in a particular cell. e.g. Cell AA3 has a manually entered value of 5, but I want to add an "R" in front of it to return R5.

Can someone help to modify the code I have below to append the letter but still keep the color highlight for visual reference?

Thanks in advance!


Sub ColorAllNumbers()

ActiveSheet.Range("aa3:ax328,bz3:ct328").SpecialCells _
(xlCellTypeConstants).Interior.ColorIndex = 4

End Sub
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Macropheliac

Board Regular
Joined
Aug 26, 2005
Messages
165
Code:
Sub ColorAllNumbers()
Dim Tcell As Range

For Each Tcell In Range("a3:a328,bz3:ct328").SpecialCells(xlCellTypeConstants)
        Tcell.Interior.ColorIndex = 4
        Tcell.Value = "R" & Tcell.Value
Next Tcell
 

Joe Was

MrExcel MVP
Joined
Feb 19, 2002
Messages
7,539
Sub CheckCellVal()
'Sheet Module Code, like: Sheet1.
Dim myRng As Range
Dim Cell As Object

Set myRng = ActiveSheet.Range("AA3:AX328","BZ3:CT328")

For Each Cell In myRng

If Application.WorksheetFunction.IsNumber(Cell.Value) = True Then

Cell.Value = "R" & Cell.Value
Cell.Interior.ColorIndex = 4
End If
Next Cell
End Sub
 

Forum statistics

Threads
1,144,370
Messages
5,723,959
Members
422,529
Latest member
mbilal429

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
Top