![]() |
macro to add alpha character to cell contents
I would like a macro that if a cell in a column (for
example, column B) contains more than 11 characters, to add an "M" to the contents of the cell. Is this possible? Thanks in advance. |
macro to add alpha character to cell contents
One way:
Public Sub AddM() Dim rCell As Range For Each rCell in Range("B1:B" & _ Range("B" & Rows.Count).End(xlUp).Row) If Len(rCell.Text) 11 Then _ rCell.Value = rCell.Text & "M" Next rCell End Sub In article , "Janna" wrote: I would like a macro that if a cell in a column (for example, column B) contains more than 11 characters, to add an "M" to the contents of the cell. Is this possible? Thanks in advance. |
macro to add alpha character to cell contents
Perfect--Just what I needed. Thanks!
-----Original Message----- One way: Public Sub AddM() Dim rCell As Range For Each rCell in Range("B1:B" & _ Range("B" & Rows.Count).End(xlUp).Row) If Len(rCell.Text) 11 Then _ rCell.Value = rCell.Text & "M" Next rCell End Sub In article , "Janna" wrote: I would like a macro that if a cell in a column (for example, column B) contains more than 11 characters, to add an "M" to the contents of the cell. Is this possible? Thanks in advance. . |
All times are GMT +1. The time now is 03:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com