Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default Text to Value

Hi. I have a column of numbers. Before my code executes, I would like to
check the column to make sure all numbers are truly numbers. Every so often
a number slips in with a ' in front of it, making it text. Is there a
simple way to remove the ' in cells where it occurs? I tried to use
edit/replace, but MS said it could not find the '. Thanks!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Text to Value

You could do this in your code, if you want, e.g.
FixCell = Val(Trim(ActiveCell.Value))


"Steph" wrote:

Hi. I have a column of numbers. Before my code executes, I would like to
check the column to make sure all numbers are truly numbers. Every so often
a number slips in with a ' in front of it, making it text. Is there a
simple way to remove the ' in cells where it occurs? I tried to use
edit/replace, but MS said it could not find the '. Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Text to Value


Good evening Steph

This routine should get rid of the annoying ' and leave "proper"
numbers and formulae alone:

Sub TextNumber()
On Error Resume Next
For Each usrcell In Selection.Areas
usrcell.FormulaLocal = usrcell.FormulaLocal
Next
End Sub

Highlight the whole range(s) you want to check and then call the
macro.

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=381362

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Text to Value



Steph wrote:
Hi. I have a column of numbers. Before my code executes, I would like to
check the column to make sure all numbers are truly numbers. Every so often
a number slips in with a ' in front of it, making it text. Is there a
simple way to remove the ' in cells where it occurs? I tried to use
edit/replace, but MS said it could not find the '. Thanks!


This happens often to me too. To ensure numbers, use the paste special
funtion to add a zero (yes, 0) to all of the suspect cells. This
converts all to real numbers.

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
Using TEXT and &TEXT - display numbers with commas, underline text Gary Excel Discussion (Misc queries) 3 May 5th 23 03:46 AM
Sumif text is contained winthin a longer text string in a cell Johnny M[_2_] Excel Worksheet Functions 3 March 21st 07 02:50 PM
Text does not display in "Text boxs" and when wrapping text in a c Esteban Excel Discussion (Misc queries) 1 March 8th 07 11:59 PM
Excel VBA: Worksheet cell .Text property: 1024 bytes text len limit loyso Excel Programming 7 May 3rd 05 02:51 PM
extracting text from within a cell - 'text to rows@ equivalent of 'text to columns' Dan E[_2_] Excel Programming 4 July 30th 03 06:43 PM


All times are GMT +1. The time now is 04:13 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"