LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.misc
REcord deleted error using parameter que
 
Posts: n/a
Default remove non-numeric characters from a cell

Hi Gord,
I don't mean to hijact this thread but your macro may be just what I'm
looking for. However, I am uncertian where to enter the details of the sheet
and range if the data to be modified is always in the same sheet and range
(other than the sumary sheet that summarises the data). In otehr words I
don't want to have to select the ranges to be changed each time.

I would appreciate any help you can offer. If necessary I will start a new
thread.

Cheers
Jim

"Gord Dibben" wrote:

Scott

This macro will remove all but numbers and decimal point(if one present)

Also strips spaces. Select range or column first then run.

Sub RemoveAlphas()
'' Remove alpha characters from a string.
Dim intI As Integer
Dim rngR As Range, rngRR As Range
Dim strNotNum As String, strTemp As String
Set rngRR = Selection.SpecialCells(xlCellTypeConstants, _
xlTextValues)
For Each rngR In rngRR
strTemp = ""
For intI = 1 To Len(rngR.Value)
If Mid(rngR.Value, intI, 1) Like "[0-9.]" Then
strNotNum = Mid(rngR.Value, intI, 1)
Else: strNotNum = ""
End If
strTemp = strTemp & strNotNum
Next intI
rngR.Value = strTemp
Next rngR
End Sub

If not familiar with VBA and macros, see David McRitchie's site for more on
"getting started".

http://www.mvps.org/dmcritchie/excel/getstarted.htm

In the meantime..........

First...create a backup copy of your original workbook.

To create a General Module, hit ALT + F11 to open the Visual Basic Editor.

Hit CRTL + R to open Project Explorer.

Find your workbook/project and select it.

Right-click and InsertModule. Paste the code in there. Save the
workbook and hit ALT + Q to return to your workbook.

Run the macro by going to ToolMacroMacros.

You can also assign this macro to a button or a shortcut key combo.


Gord Dibben Excel MVP

On Mon, 23 May 2005 10:41:18 -0700, SWBodager
wrote:

How can I remove all non-numeric characters from a cell? I am trying to
figure final grades for all the students in our school. The cells that I am
working with contain the percentage and the appropriate letter grade (i.e. 80
C+, 85B, 101 A+, etc.) The grades can be two or three digit numeric and one
or two characters (may or may not have a space seperating the numbers from
the leters). Thanks for any help on this,
Scott Bodager )



 
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
Numeric content in one cell ( implicit formula ) and the result in another one PeDevillers Excel Discussion (Misc queries) 7 March 2nd 05 07:40 AM
Maximum characters that can be displayed in a cell Sandeeep Excel Discussion (Misc queries) 2 February 28th 05 05:39 PM
limit number of characters in a cell abfabrob Excel Discussion (Misc queries) 9 February 11th 05 04:19 PM
Visible cell characters sixtyseven67 Excel Discussion (Misc queries) 1 February 7th 05 09:05 PM
#### error if cell has more than 255 characters Budalacovyek Excel Discussion (Misc queries) 1 December 8th 04 06:42 PM


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