LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.misc
Norman Jones
 
Posts: n/a
Default Substring in excel? How about regular expressions?

Hi Samuel,

Try something like:

'=============
Public Sub Tester()
Dim sStr As String
Dim i As Long
Dim LastRow As Long

LastRow = Cells(Rows.Count, "A").End(xlUp).Row

For i = 1 To LastRow
sStr = ActiveSheet.Cells(i, "A").Value
If Left(sStr, 3) = "USA" Then
'Do something, e.g.:
Cells(i, "A").Interior.ColorIndex = 6
Else
'Do something else
End If
Next i

End Sub
'<<=============


---
Regards,
Norman



"Samuel" wrote in message
oups.com...
I'm sorry, Miguel, but I misphrased it. I want to continue with the
next iteration. Not break out complelty.
If I change the 'next' to a 'next for' i get the same error.



 
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
unhide menu bar in excel - just disappeared Sean Setting up and Configuration of Excel 12 April 4th 23 10:19 AM
Excel User Conference - Last days for regular registration - Mar 15th Damon Longworth Excel Discussion (Misc queries) 0 March 10th 06 12:29 PM
Excel User Conference - Last days for regular registration - Mar 15th Damon Longworth Excel Worksheet Functions 0 March 10th 06 12:29 PM
opening csv file in regular excel format sureshbabussb Excel Discussion (Misc queries) 1 December 6th 05 03:53 PM
Opening two separate instances of Excel Ron Bishop Excel Discussion (Misc queries) 2 August 4th 05 05:30 PM


All times are GMT +1. The time now is 05:04 PM.

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"