Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 80
Default text and numbers in cell

I want to delete the text in 30.000 cells from a cell which contains text and
numbers. What is the easiest way to do so?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,047
Default text and numbers in cell

Hi Henk

Copy this code and use the function Digitsonly(a2), copy down, copy and
paste values

hth
regards from Brazil
Marcelo

************************************************** ***
Public Function DigitsOnly(sStr As String) As Variant
Dim oRegExp As Object

Set oRegExp = CreateObject("VBScript.RegExp")

With oRegExp
.IgnoreCase = True
.Global = True
oRegExp.Pattern = "\D"

DigitsOnly = oRegExp.Replace(sStr, vbNullString)
End With
End Function
************************************************** ****



"Henk" escreveu:

I want to delete the text in 30.000 cells from a cell which contains text and
numbers. What is the easiest way to do so?

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default text and numbers in cell

Henk


Sub RemoveAlphas()
' Remove alpha characters from a string.
' except for decimal points and hyphens.
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
'change to [0-9] if dec. pt. and hyphen not required
strNotNum = Mid(rngR.Value, intI, 1)
Else: strNotNum = ""
End If
strTemp = strTemp & strNotNum
Next intI
rngR.Value = strTemp
Next rngR

End Sub


Gord Dibben MS Excel MVP


On Wed, 9 Aug 2006 06:43:02 -0700, Henk wrote:

I want to delete the text in 30.000 cells from a cell which contains text and
numbers. What is the easiest way to do so?

Thanks


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
Why are 1/2 my numbers imported as text and the rest as numbers? KBear Excel Discussion (Misc queries) 2 April 21st 06 01:40 PM
Extract numbers from cell with Text and Numbers wiredwrx New Users to Excel 3 April 18th 06 10:57 PM
Using numbers as numbers in a cell having text Roland Excel Discussion (Misc queries) 2 March 11th 06 12:41 PM
text and numbers same cell and formulas still work (like lotus) rmoore Excel Worksheet Functions 4 July 20th 05 07:02 PM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


All times are GMT +1. The time now is 03:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"