Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Suppose Cell A1 has "TWID10293 Comments" entry an
cell A2 has "TW298382 Comment on this." entry I wish to retrieve the numeric part of A1 and A2 in B1 and B2 respectively. ie B1 should have "10293" and B2 should have "29382". |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If you wish to retain the original data, copy Column A to B then run this
macro on Column B. 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 Gord Dibben Excel MVP On Tue, 24 Feb 2004 21:56:05 -0800, Excel Prg wrote: Suppose Cell A1 has "TWID10293 Comments" entry and cell A2 has "TW298382 Comment on this." entry. I wish to retrieve the numeric part of A1 and A2 in B1 and B2 respectively. ie B1 should have "10293" and B2 should have "29382". |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
See the 'Val' function in VBE help.
HTH Paul -------------------------------------------------------------------------------------------------------------- Be advised to back up your WorkBook before attempting to make changes. -------------------------------------------------------------------------------------------------------------- Suppose Cell A1 has "TWID10293 Comments" entry and cell A2 has "TW298382 Comment on this." entry. I wish to retrieve the numeric part of A1 and A2 in B1 and B2 respectively. ie B1 should have "10293" and B2 should have "29382". |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel: I want to assign numeric values to letters in a speradsheet | Excel Discussion (Misc queries) | |||
TO DELETE ONLY NUMERIC VALUES IN A CHARACTER AND NUMERIC CELL IN | Excel Discussion (Misc queries) | |||
Exclude #N/A values and Return Numeric values to consecutive cells in Single Row | Excel Worksheet Functions | |||
Return Numeric Labels that have different Numeric Values | Excel Worksheet Functions | |||
How do I plot non-numeric values in a graph in Excel? | Charts and Charting in Excel |