Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to recognize a specific letter in a cell
Hi,
I have a lots of cells in which there it written things like these: E2245_Gv070830f 3,5_3,5_01 E224_Gv070830o 3,5_3,5_01 E224_Gv071220f 4_4_01 I want to select all cells in which letter "o" or "f" is present. How can i write this in code?? these letters can have different places in the cell.. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
how to recognize a specific letter in a cell
Hi Ksenija
Try below: Option Explicit '---------------------------------------------------------- ' Procedure : TestForLetter ' Date : 20090119 ' Author : Joergen Bondesen ' Modifyed by : Select cell with Array Letter ' Purpose : ' Note : '---------------------------------------------------------- ' Sub TestForLetter() Dim TestLetter As Variant TestLetter = Array("o", "f") Dim RRange As Range Set RRange = Selection Dim cell As Range For Each cell In RRange Dim x As Long For x = LBound(TestLetter) To UBound(TestLetter) Dim Testx As Long Testx = InStr(1, cell, TestLetter(x)) If Testx < 0 Then x = UBound(TestLetter) Next x If Testx < 0 Then Dim SelCell As Range If SelCell Is Nothing Then Set SelCell = cell Else Set SelCell = Union(SelCell, cell) End If End If Next cell If Not SelCell Is Nothing Then SelCell.Select End If Set RRange = Nothing Set SelCell = Nothing End Sub -- Best regards Joergen Bondesen "Ksenija" skrev i en meddelelse ... Hi, I have a lots of cells in which there it written things like these: E2245_Gv070830f 3,5_3,5_01 E224_Gv070830o 3,5_3,5_01 E224_Gv071220f 4_4_01 I want to select all cells in which letter "o" or "f" is present. How can i write this in code?? these letters can have different places in the cell.. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to make my code recognize one letter in a text in a cell??? | Excel Programming | |||
how o recognize a specific letter in different places in a cell?? | Excel Programming | |||
Can I recognize the specific letters in a cell using formulas? | Excel Worksheet Functions | |||
linking a cell with a specific letter value to a cell with a formu | Excel Worksheet Functions | |||
How do I find a cell starting with a specific letter? | Excel Discussion (Misc queries) |