Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default 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
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
How to make my code recognize one letter in a text in a cell??? Ksenija Excel Programming 3 January 19th 09 01:18 PM
how o recognize a specific letter in different places in a cell?? Ksenija Excel Programming 0 January 19th 09 10:28 AM
Can I recognize the specific letters in a cell using formulas? Stevo Excel Worksheet Functions 3 March 26th 08 12:41 PM
linking a cell with a specific letter value to a cell with a formu tommo64 Excel Worksheet Functions 4 April 3rd 06 10:44 AM
How do I find a cell starting with a specific letter? Bking Excel Discussion (Misc queries) 5 July 18th 05 05:14 AM


All times are GMT +1. The time now is 11:01 PM.

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"