Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Search and find

Need help on creating a routine that loops down through a
spreadsheet's rows that contain entries and compares the
entry in column 1 (State abrevation) with column 2 entry
(shipment method). Specificly I want to return a msgbox to
the user when the state = "HI" or "AK" and the ship method
is "ground", and then quits the vba form so the user can
correct the situation.
Thnaks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Search and find

Something like this:

Option Explicit
Sub testme()

Dim myCell As Range
Dim myRng As Range

With Worksheets("sheet1")
Set myRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp))
End With

For Each myCell In myRng.Cells
With myCell
Select Case LCase(.Value)
Case "ak", "hi"
.Select
MsgBox "error on row: " & .Row
Exit Sub
Case Else
'do nothing
End Select
End With
Next myCell

End Sub

(not sure how you're userform works, though.)

Couldn't they just take the interstate to hi?



Rick K wrote:

Need help on creating a routine that loops down through a
spreadsheet's rows that contain entries and compares the
entry in column 1 (State abrevation) with column 2 entry
(shipment method). Specificly I want to return a msgbox to
the user when the state = "HI" or "AK" and the ship method
is "ground", and then quits the vba form so the user can
correct the situation.
Thnaks


--

Dave Peterson

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
Search / Find Function Harry C. Excel Worksheet Functions 6 June 16th 09 05:40 PM
Search / find Formula Michael Excel Worksheet Functions 1 December 22nd 08 03:22 PM
IF with Search/Find??? TotallyConfused Excel Worksheet Functions 5 August 1st 08 10:05 AM
Find and search by column Brian Excel Discussion (Misc queries) 8 May 13th 05 12:35 AM
Can Search find 2 or more "/"? Wind54Surfer Excel Discussion (Misc queries) 2 February 22nd 05 04:31 PM


All times are GMT +1. The time now is 10:29 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"