Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Numeric content in one cell ( implicit formula ) and the result in another one | Excel Discussion (Misc queries) | |||
Maximum characters that can be displayed in a cell | Excel Discussion (Misc queries) | |||
limit number of characters in a cell | Excel Discussion (Misc queries) | |||
Visible cell characters | Excel Discussion (Misc queries) | |||
#### error if cell has more than 255 characters | Excel Discussion (Misc queries) |