LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA: New Idea to lookup record


I guess I didnt fully understand the Match function, and I find codin
it this way easier. Although I still cant get it to work.

With the following code I get the message "ssn not found" even when th
ssn entered is listed in the column.

Do I need to convert the InputCustSSN to an Integer?


Private Sub cmdSelectRecord_Click()

Dim Cell As Range
Dim found As Boolean

Dim lookUpRange As Range
Dim lookupsheet As Sheet1
Dim InputCustSSN As String
Dim rngActive As Range

n = ActiveCell.Value

Set rngActive = ActiveCell.Range("f27:f307")

InputCustSSN = txtCustSSN

found = False

If n < "" Then
For Each Cell In rngActive
If Cell.Value = InputCustSSN Then
found = True
Exit For
End If
Next Cell
End If

If Not found Then
MsgBox "SSN Not Found!"
Else
MsgBox "Customer SSN Found"
End If

End Sub


Its been a long day.
I promise I will take a refresher course on VBA as soon as the next on
is offered

--
Mcastee
-----------------------------------------------------------------------
Mcasteel's Profile: http://www.excelforum.com/member.php...fo&userid=1569
View this thread: http://www.excelforum.com/showthread.php?threadid=27258

 
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
Record Lookup Tojib Excel Discussion (Misc queries) 0 May 6th 08 10:44 PM
lookup the next matching record. tess Excel Worksheet Functions 5 April 4th 07 03:17 PM
lookup information in a row like a record utraceme Excel Worksheet Functions 1 April 18th 05 05:05 PM
auto filter missing record count & a fix idea Todd F Excel Programming 2 June 11th 04 07:37 PM
Anyone has any idea about XF: Extended Format (E0h) record ? KongHu Excel Programming 0 May 24th 04 04:58 AM


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