Adding apostrophe in front of numbers only

22strider

Active Member
Joined
Jun 11, 2007
Messages
311
Hi

Could any one please help me adding apostrophe (') in front of the data with number format only?

I have a list of part numbers that I am trying to import to Access. But after importing the records with format "number" appear as "#Num!". But if I add apostrophe in front of the records then the record appear fine in Access. But the apostrophe should only be in front of the numbers only not in front of text.

I am new to writing codes in VBA so can't separate numbers from text for adding apostrophe. Any help is appreciated.

Thanks
Rajesh
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Does the ISNUMBER function work in this example? Not sure if you;re familiar, but Excel has an ISNUMBER function where if its a numeric it will return True but if not it will return False. It might be easier than doing code, but only if those values are truly numeric still.
 
Upvote 0
Rajesh

How are you doing this import/export?

You mention code, can you post that code?
 
Upvote 0
Helllo Ryan

Thanks for the idea; I used it in writing following code in VBA. It is "ISNumeric" for VBA

"Sub AddApostrophe()

Dim LValue As Boolean
Do While Not IsEmpty(ActiveCell)

LValue = IsNumeric(ActiveCell.Value)
If LValue = "True" Then
ActiveCell.Value = "'" & ActiveCell.Value
Else
ActiveCell.Value = ActiveCell.Value
End If
ActiveCell.Offset(1, 0).Select
Loop

End Sub"

Thanks again
Rajesh
 
Upvote 0
Is there a reason the apostrophe needs to be there? If it is just to change the values into text then you could just format the cell using the "@" format. Not sure if that helps?
 
Upvote 0
It is just because MS Access was being picky and won't see the imported part numbers from excel any other way.
 
Upvote 0

Forum statistics

Threads
1,214,534
Messages
6,120,084
Members
448,943
Latest member
sharmarick

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top