ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Replace Number with Text using Macro (https://www.excelbanter.com/excel-discussion-misc-queries/22661-replace-number-text-using-macro.html)

Carter68

Replace Number with Text using Macro
 
I need help replacing a number with text using a Macro.

For example: I need to replace numbers in Column B with text

Replace 212 with "Sike Branch Manager"
Replace 154 with "So County Manager"
Replace 188 with "Bridge Manager"

Any help would be greatly appreciated.

Bob Phillips


Sub ReplaceEm()
Dim iLastRow As Long
Dim i As Long

iLAstRow = Cells(Rows.Count,"A").End(xlUp).Row
For i = 1 To iLastRow
WIth Cells(i,"A").
Select Case Value
Case 212 : .Value = "Sike Branch Manager"
Case 154 : .Value = "So County Manager"
Case 188 : .Value = "Bridge Manager"
'etc
End Select
End With
Next i
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Carter68" wrote in message
...
I need help replacing a number with text using a Macro.

For example: I need to replace numbers in Column B with text

Replace 212 with "Sike Branch Manager"
Replace 154 with "So County Manager"
Replace 188 with "Bridge Manager"

Any help would be greatly appreciated.




Carter68

I am getting a compile error with this line.........

With Cells(i,"A")

"Bob Phillips" wrote:


Sub ReplaceEm()
Dim iLastRow As Long
Dim i As Long

iLAstRow = Cells(Rows.Count,"A").End(xlUp).Row
For i = 1 To iLastRow
WIth Cells(i,"A").
Select Case Value
Case 212 : .Value = "Sike Branch Manager"
Case 154 : .Value = "So County Manager"
Case 188 : .Value = "Bridge Manager"
'etc
End Select
End With
Next i
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Carter68" wrote in message
...
I need help replacing a number with text using a Macro.

For example: I need to replace numbers in Column B with text

Replace 212 with "Sike Branch Manager"
Replace 154 with "So County Manager"
Replace 188 with "Bridge Manager"

Any help would be greatly appreciated.





Bob Phillips

Typo

Sub ReplaceEm()
Dim iLastRow As Long
Dim i As Long

iLAstRow = Cells(Rows.Count,"A").End(xlUp).Row
For i = 1 To iLastRow
WIth Cells(i,"A")
Select Case .Value
Case 212 : .Value = "Sike Branch Manager"
Case 154 : .Value = "So County Manager"
Case 188 : .Value = "Bridge Manager"
'etc
End Select
End With
Next i
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Bob Phillips" wrote in message
...

Sub ReplaceEm()
Dim iLastRow As Long
Dim i As Long

iLAstRow = Cells(Rows.Count,"A").End(xlUp).Row
For i = 1 To iLastRow
WIth Cells(i,"A").
Select Case Value
Case 212 : .Value = "Sike Branch Manager"
Case 154 : .Value = "So County Manager"
Case 188 : .Value = "Bridge Manager"
'etc
End Select
End With
Next i
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Carter68" wrote in message
...
I need help replacing a number with text using a Macro.

For example: I need to replace numbers in Column B with text

Replace 212 with "Sike Branch Manager"
Replace 154 with "So County Manager"
Replace 188 with "Bridge Manager"

Any help would be greatly appreciated.







All times are GMT +1. The time now is 07:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com