Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Apostrophe in Numbers

I understand that when there is an apostrophe in front of a number that is
only visible in the forumla bar, that the the number is text. I am trying to
figure out a way to add the apostrophe to a column of numbers. I need this
to be done in order for vlookups to give me an accurate value. Because of
links to querys from my database, I cannot convert the numberic texts to
numbers. I have to somehow convert the numbers to the text with an
apostrophe. I've searched and searched for an answer. Can anyone please
help? Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,696
Default Apostrophe in Numbers

have an apostophe in, say, cell A1.

Assume your numbers are in column B

in column C, =A$1&B2

Paste down your column.

Copy your new column and paste special/values

They are now text.

"rivkee" wrote:

I understand that when there is an apostrophe in front of a number that is
only visible in the forumla bar, that the the number is text. I am trying to
figure out a way to add the apostrophe to a column of numbers. I need this
to be done in order for vlookups to give me an accurate value. Because of
links to querys from my database, I cannot convert the numberic texts to
numbers. I have to somehow convert the numbers to the text with an
apostrophe. I've searched and searched for an answer. Can anyone please
help? Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Apostrophe in Numbers

Hi,

This is a first, normally posters want to get rid of apostrophes. Right
click your sheet tab, view code and paste this in and run it. It assumes
column A so change to suit

Sub I_Hate_Apostrophes()
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set Myrange = Range("A1:A" & lastrow)
For Each c In Myrange
If Not c.HasFormula And IsNumeric(c) Then
c.Value = "'" & c.Value
End If
Next
End Sub

Mike

"rivkee" wrote:

I understand that when there is an apostrophe in front of a number that is
only visible in the forumla bar, that the the number is text. I am trying to
figure out a way to add the apostrophe to a column of numbers. I need this
to be done in order for vlookups to give me an accurate value. Because of
links to querys from my database, I cannot convert the numberic texts to
numbers. I have to somehow convert the numbers to the text with an
apostrophe. I've searched and searched for an answer. Can anyone please
help? Thanks!

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default Apostrophe in Numbers

Private Sub addApostrophe()
Const whatColumn = "A" 'Change to your needs
Dim looper As Long 'looper = 5 Starting row of data
Dim lastToCheckRow As Long

lastToCheckRow = Range(whatColumn & Rows.Count).End(xlUp).Row

For looper = 5 To lastToCheckRow
Cells(looper, whatColumn).Value = "'" & Cells(looper,
whatColumn).Value
Next looper
End Sub

"rivkee" wrote:

I understand that when there is an apostrophe in front of a number that is
only visible in the forumla bar, that the the number is text. I am trying to
figure out a way to add the apostrophe to a column of numbers. I need this
to be done in order for vlookups to give me an accurate value. Because of
links to querys from my database, I cannot convert the numberic texts to
numbers. I have to somehow convert the numbers to the text with an
apostrophe. I've searched and searched for an answer. Can anyone please
help? Thanks!

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Apostrophe in Numbers

I know... I haven't been able to find anything about adding apostrophes!
Thanks so much Mike H! Your code works perfectly. This is such a saver for
me. Cheers!


"Mike H" wrote:

Hi,

This is a first, normally posters want to get rid of apostrophes. Right
click your sheet tab, view code and paste this in and run it. It assumes
column A so change to suit

Sub I_Hate_Apostrophes()
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set Myrange = Range("A1:A" & lastrow)
For Each c In Myrange
If Not c.HasFormula And IsNumeric(c) Then
c.Value = "'" & c.Value
End If
Next
End Sub

Mike

"rivkee" wrote:

I understand that when there is an apostrophe in front of a number that is
only visible in the forumla bar, that the the number is text. I am trying to
figure out a way to add the apostrophe to a column of numbers. I need this
to be done in order for vlookups to give me an accurate value. Because of
links to querys from my database, I cannot convert the numberic texts to
numbers. I have to somehow convert the numbers to the text with an
apostrophe. I've searched and searched for an answer. Can anyone please
help? Thanks!



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Apostrophe in Numbers

Glad I could help

"rivkee" wrote:

I know... I haven't been able to find anything about adding apostrophes!
Thanks so much Mike H! Your code works perfectly. This is such a saver for
me. Cheers!


"Mike H" wrote:

Hi,

This is a first, normally posters want to get rid of apostrophes. Right
click your sheet tab, view code and paste this in and run it. It assumes
column A so change to suit

Sub I_Hate_Apostrophes()
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set Myrange = Range("A1:A" & lastrow)
For Each c In Myrange
If Not c.HasFormula And IsNumeric(c) Then
c.Value = "'" & c.Value
End If
Next
End Sub

Mike

"rivkee" wrote:

I understand that when there is an apostrophe in front of a number that is
only visible in the forumla bar, that the the number is text. I am trying to
figure out a way to add the apostrophe to a column of numbers. I need this
to be done in order for vlookups to give me an accurate value. Because of
links to querys from my database, I cannot convert the numberic texts to
numbers. I have to somehow convert the numbers to the text with an
apostrophe. I've searched and searched for an answer. Can anyone please
help? Thanks!

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
Apostrophe Infront of Text & Numbers amandahardy2005 Excel Worksheet Functions 1 May 22nd 08 08:04 PM
Always have apostrophe snax500 Excel Discussion (Misc queries) 5 June 22nd 07 08:26 PM
How to reformat numbers stored as text (apostrophe at beginning) Dave Excel Discussion (Misc queries) 1 May 11th 05 02:34 AM
Delete apostrophe Susana Conklin via OfficeKB.com Excel Worksheet Functions 3 January 8th 05 01:54 AM
Add apostrophe Tony Wainwright Excel Worksheet Functions 4 October 29th 04 01:50 PM


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

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

About Us

"It's about Microsoft Excel"