Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default HowTo add a period to front of EVERY text cell in a Excel column

I want to add a period to the FRONT of each different text string in a column
of text cells, How do I do this?

example
from this to this

KQWLN .KQWLN
ERULM .ERULM
MQMLD .MQMLD
TDQAH .TDQAH

Thank you for your Answer
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default HowTo add a period to front of EVERY text cell in a Excel column

Adam,

If you only want one period:

Sub Macro1()
Dim myCell As Range

For Each myCell In Range("A:A").SpecialCells(xlCellTypeConstants, 2)
If Left(myCell.Value, 1) < "." Then myCell.Value = "." & myCell.Value
Next myCell
End Sub

If you want another period whether one exists or not, simply delete this:
If Left(myCell.Value, 1) < "." Then

HTH,
Bernie
MS Excel MVP


"adamcollegeman" wrote in message
...
I want to add a period to the FRONT of each different text string in a column
of text cells, How do I do this?

example
from this to this

KQWLN .KQWLN
ERULM .ERULM
MQMLD .MQMLD
TDQAH .TDQAH

Thank you for your Answer



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default HowTo add a period to front of EVERY text cell in a Excel colu

Dear Bernie,

thank you so much for the reply,
I have a slight follow on question, which is:

could you show me what this subroutine would look like if the column of text
was column B and I do not know how many rows long it is and adding only one
period at the beginning to each text cell filled with text in that column B?

Thank you! :) I really appreciate your considerations

"Bernie Deitrick" wrote:

Adam,

If you only want one period:

Sub Macro1()
Dim myCell As Range

For Each myCell In Range("A:A").SpecialCells(xlCellTypeConstants, 2)
If Left(myCell.Value, 1) < "." Then myCell.Value = "." & myCell.Value
Next myCell
End Sub

If you want another period whether one exists or not, simply delete this:
If Left(myCell.Value, 1) < "." Then

HTH,
Bernie
MS Excel MVP


"adamcollegeman" wrote in message
...
I want to add a period to the FRONT of each different text string in a column
of text cells, How do I do this?

example
from this to this

KQWLN .KQWLN
ERULM .ERULM
MQMLD .MQMLD
TDQAH .TDQAH

Thank you for your Answer




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default HowTo add a period to front of EVERY text cell in a Excel colu

Just change the Range("A:A") to Range("B:B") eg

Sub Macro1()
Dim myCell As Range

For Each myCell In Range("B:B").SpecialCells(xlCellTypeConstants, 2)
If Left(myCell.Value, 1) < "." Then myCell.Value = "." & myCell.Value
Next myCell
End Sub

Hope this helps
Rowan

adamcollegeman wrote:
Dear Bernie,

thank you so much for the reply,
I have a slight follow on question, which is:

could you show me what this subroutine would look like if the column of text
was column B and I do not know how many rows long it is and adding only one
period at the beginning to each text cell filled with text in that column B?

Thank you! :) I really appreciate your considerations

"Bernie Deitrick" wrote:


Adam,

If you only want one period:

Sub Macro1()
Dim myCell As Range

For Each myCell In Range("A:A").SpecialCells(xlCellTypeConstants, 2)
If Left(myCell.Value, 1) < "." Then myCell.Value = "." & myCell.Value
Next myCell
End Sub

If you want another period whether one exists or not, simply delete this:
If Left(myCell.Value, 1) < "." Then

HTH,
Bernie
MS Excel MVP


"adamcollegeman" wrote in message
...

I want to add a period to the FRONT of each different text string in a column
of text cells, How do I do this?

example
from this to this

KQWLN .KQWLN
ERULM .ERULM
MQMLD .MQMLD
TDQAH .TDQAH

Thank you for your Answer




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default HowTo add a period to front of EVERY text cell in a Excel colu

Thank you! Rowan and Bernie, have a great thanksgiving.

"Rowan Drummond" wrote:

Just change the Range("A:A") to Range("B:B") eg

Sub Macro1()
Dim myCell As Range

For Each myCell In Range("B:B").SpecialCells(xlCellTypeConstants, 2)
If Left(myCell.Value, 1) < "." Then myCell.Value = "." & myCell.Value
Next myCell
End Sub

Hope this helps
Rowan

adamcollegeman wrote:
Dear Bernie,

thank you so much for the reply,
I have a slight follow on question, which is:

could you show me what this subroutine would look like if the column of text
was column B and I do not know how many rows long it is and adding only one
period at the beginning to each text cell filled with text in that column B?

Thank you! :) I really appreciate your considerations

"Bernie Deitrick" wrote:


Adam,

If you only want one period:

Sub Macro1()
Dim myCell As Range

For Each myCell In Range("A:A").SpecialCells(xlCellTypeConstants, 2)
If Left(myCell.Value, 1) < "." Then myCell.Value = "." & myCell.Value
Next myCell
End Sub

If you want another period whether one exists or not, simply delete this:
If Left(myCell.Value, 1) < "." Then

HTH,
Bernie
MS Excel MVP


"adamcollegeman" wrote in message
...

I want to add a period to the FRONT of each different text string in a column
of text cells, How do I do this?

example
from this to this

KQWLN .KQWLN
ERULM .ERULM
MQMLD .MQMLD
TDQAH .TDQAH

Thank you for your Answer






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
How add a digit to front of number in each cell in excexl column Killarney Tom Excel Discussion (Misc queries) 2 April 5th 23 01:10 PM
HOW DO I PUT THE TEXT IN FRONT OF MY PICTURE IN EXCEL? jessica j. Excel Discussion (Misc queries) 0 February 26th 07 10:08 PM
How do I add an apostrophe in front of existing column in Excel? Carlah2 Excel Discussion (Misc queries) 2 December 7th 05 03:56 PM
Formula for adding a comma in front of text in a cell Shelley Excel Worksheet Functions 4 April 18th 05 04:34 PM
Howto use excel cell value to lookup an oracle table Andre Excel Discussion (Misc queries) 0 April 5th 05 09:44 AM


All times are GMT +1. The time now is 10:28 AM.

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"