Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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.

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert character at beginning of cell without changing contents elle Excel Discussion (Misc queries) 4 April 3rd 23 06:52 PM
if alpha character samuel Excel Discussion (Misc queries) 4 December 17th 08 03:22 AM
Prevent alpha character in numeric cell Brazil Excel Discussion (Misc queries) 2 July 21st 08 09:28 PM
Parsing a alpha character out of a cell Lram Excel Worksheet Functions 7 October 17th 05 10:56 PM
Increment Alpha Character Dan Excel Programming 4 June 3rd 04 07:32 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"