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
 

Some videos you may like

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

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
 

Watch MrExcel Video

Forum statistics

Threads
1,114,060
Messages
5,545,761
Members
410,704
Latest member
Cobber2008
Top