Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I don't think you can use Find to find the cells and Find doesn't support
Regular Expressions. Try code like Function GetValues(InRange As Range, Length As Long) As Range Dim Res As Range Dim R As Range For Each R In InRange.Cells If IsNumeric(R.Text) = True Then If Len(R.Text) = Length Then If Res Is Nothing Then Set Res = R Else Set Res = Application.Union(Res, R) End If End If End If Next R Set GetValues = Res End Function You can then call this function with code like: Sub AAA() Dim R As Range Dim RR As Range Set RR = GetValues(InRange:=Range("A1:A10"), Length:=11) If RR Is Nothing Then Debug.Print "NOT FOUND" Else For Each R In RR Debug.Print R.Address, R.Text Next R End If End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel, 10 Years Pearson Software Consulting www.cpearson.com (email on the web site) "Andrius B." wrote in message ... Hi all. Maybe smb could make an advice how to do this: I have to find all the rows in a Excel worksheet, which contain cell with a 11 digit numeric value. E.g. two rows each with 3 cells with values: ------------------------------------ Will | Smith | 4524574561 Gerry | Smith | LowStreet 20 ------------------------------------ So, the first row should be accepted, and the second - ignored. I tried different examples using oSheet.Cells.Find(What:=... but unsuccesfully. Is there a way to use regular expressions Thanks in advance. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Finding NEXT to last, non zero numeric value in a row | Excel Worksheet Functions | |||
TO DELETE ONLY NUMERIC VALUES IN A CHARACTER AND NUMERIC CELL IN | Excel Discussion (Misc queries) | |||
finding only cells with a numeric value | Excel Discussion (Misc queries) | |||
Return Numeric Labels that have different Numeric Values | Excel Worksheet Functions | |||
Finding the mode (alpha numeric) | Excel Discussion (Misc queries) |