Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
nj nj is offline
external usenet poster
 
Posts: 9
Default For Each statement setup

I'm not sure I fully understand but perhaps this example would get you
the

I use it to search for key words in the cells in my previously set
selection. It is two loops, a "For... Each" to move thru the rows and
then a "For... Next" to work inside the cells themselves.

For Each Cell In Selection

'Loop to pick character in cell
For X = 1 To Len(Cell.Value)

'Loop to pick value to look FOR
'for y = 1 to
If Mid(Cell.Value, X, 1) = "Eri" Then
Cells(Cell.Row, 1).Value = Cells(Cell.Row, 1).Value & " eri"
End If
If Mid(Cell.Value, X, 1) = "test" Then
Cells(Cell.Row, 1).Value = Cells(Cell.Row, 1).Value & " test"
End If
If Mid(Cell.Value, X, 1) = "admin" Then
Cells(Cell.Row, 1).Value = Cells(Cell.Row, 1).Value & "
admin"
End If
'next y
Next X
Next Cell

Hope that helps!
NJ

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
IF statement inside a SUMIF statement.... or alternative method Sungibungi Excel Worksheet Functions 3 December 4th 09 06:22 PM
Reconcile Bank statement & Credit card statement & accounting data Bklynhyc Excel Worksheet Functions 0 October 7th 09 09:07 PM
Setup of an IF AND statement LFleming Excel Worksheet Functions 0 February 13th 08 04:09 AM
Club Dues collection report and statement setup cleanwake Excel Discussion (Misc queries) 0 February 6th 06 03:02 PM
how do i setup an if, then statement steve Excel Programming 1 January 2nd 05 10:50 PM


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

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

About Us

"It's about Microsoft Excel"