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

I have a worksheet that contains follow up data that I would like my users,
via a userform to edit. I have constructed an "Event ID" that uniquely
identifies each row in the spreadsheet. My hope was to have a search dropdown
box that displays the current Event ID numbers, enable the user to verifiy
that this is correct entry, then load the information on a userform for
editing and completion.

The Event ID is made by combining the Account Number with an Event Code then
followed by the Excel Date Serial Number.

The spreadsheet is built as follows:

Event ID Acct Number Auditor
333333-NPSG9a-38439 333333 Jones
121212-NPSG2a1-38440 121212 Smith

I set up the following code on a command button:

Private Sub ExamineEventIDInfoButton_Click()

sKey = GetFollowUpData.EventID.Value
Set rnga = Range("EventID")

Set c = rnga.Find(sKey, LookIn:=xlValues)
If Not c Is Nothing Then
MsgBox c.Row 'Row of Match

'Assign data in row to user controls
GetFollowUpData.EventID = Cells(c.Row, 1) 'EventID
GetFollowUpData.AcctNumberTxt = Cells(c.Row, 2) 'Acct Number
GetFollowUpData.AuditorLast = Cells(c.Row, 3) 'Auditor Last
Else
MsgBox "No Match Found"

End If

End Sub

I keep getting the "Row Found" as the first blank row on the spreadsheet.

Should I place this on a different event? Is the search key the problem?

Any advice?

WilRn
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Search Macro Help

Well,

Dummy me found my own answer.

When in doubt double check all the reference values and field names. I used
the wrong comboBox name on the secound line. My code should have been:

Private Sub ExamineEventIDInfoButton_Click()

sKey = GetFollowUpData.FINDEventID.Value
Set rnga = Range("EventID")

Set c = rnga.Find(sKey, LookIn:=xlValues)
If Not c Is Nothing Then
MsgBox c.Row 'Row of Match

'Assign data in row to user controls
GetFollowUpData.EventID = Cells(c.Row, 1) 'EventID
GetFollowUpData.AcctNumberTxt = Cells(c.Row, 2) 'Acct Number
GetFollowUpData.AuditorLast = Cells(c.Row, 3) 'Auditor Last
Else
MsgBox "No Match Found"

End If

End Sub


Boy, . . . do I feel sheeeeepppppiissshh!

Baa Baa for now,

WillRn

"WillRn" wrote:

I have a worksheet that contains follow up data that I would like my users,
via a userform to edit. I have constructed an "Event ID" that uniquely
identifies each row in the spreadsheet. My hope was to have a search dropdown
box that displays the current Event ID numbers, enable the user to verifiy
that this is correct entry, then load the information on a userform for
editing and completion.

The Event ID is made by combining the Account Number with an Event Code then
followed by the Excel Date Serial Number.

The spreadsheet is built as follows:

Event ID Acct Number Auditor
333333-NPSG9a-38439 333333 Jones
121212-NPSG2a1-38440 121212 Smith

I set up the following code on a command button:

Private Sub ExamineEventIDInfoButton_Click()

sKey = GetFollowUpData.EventID.Value
Set rnga = Range("EventID")

Set c = rnga.Find(sKey, LookIn:=xlValues)
If Not c Is Nothing Then
MsgBox c.Row 'Row of Match

'Assign data in row to user controls
GetFollowUpData.EventID = Cells(c.Row, 1) 'EventID
GetFollowUpData.AcctNumberTxt = Cells(c.Row, 2) 'Acct Number
GetFollowUpData.AuditorLast = Cells(c.Row, 3) 'Auditor Last
Else
MsgBox "No Match Found"

End If

End Sub

I keep getting the "Row Found" as the first blank row on the spreadsheet.

Should I place this on a different event? Is the search key the problem?

Any advice?

WilRn

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 Macro Eán[_2_] Excel Worksheet Functions 3 April 21st 10 02:51 PM
macro search puiuluipui Excel Discussion (Misc queries) 15 June 18th 08 02:13 PM
Search In a Macro/VBA cbanks Excel Discussion (Misc queries) 2 May 4th 06 10:34 PM
Excel XP VBA code to search all macro code in Excel module for specific search string criteria Ed[_18_] Excel Programming 4 May 20th 04 02:08 PM
Excel XP VBA code to search all macro code in Excel module for specific search string criteria Frank Kabel Excel Programming 0 May 19th 04 08:11 PM


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