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: 40
Default Retrieving Excel data to post to a form

All...

I'm running into a couple of issues when attempting to run the code below
and would appreciate any assistance in what I'm doing incorrectly... First
is an Overflow issue when attempting to set a LookupID variable, secondly,
I'm not sure whether the RowIndex variable is structured properly...

Here is what I'm attempting to do:
I have a 10 digit numeric value that is stored in Excel using a form; I now
want to use the same 10 digit numeric field to allow the User to find the
specific Row of data and display the corresponding fields to a new form...

Here is the code that I'm attempting to run:
Private Sub ReferenceID_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim LastRow As Long
Dim LookupID As Long
Dim RowIndex As Long

LastRow = (Selection.CurrentRegion.Rows.Count)

If IsNumeric(Me.ReferenceID.Text) Then
LookupID = (CLng(Me.ReferenceID.Text))
Else
Me.ReferenceID.Text = ""
MsgBox "Reference ID number must be numeric."
Cancel = True
End If

With Worksheets("Raw Data").Range("C1:C" & LastRow)
Set RowIndex = (Selection.Find(What:=LookupID, After:=ActiveCell,
LookIn:=xlValues, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Row)
End With

Department.Text = Cells(RowIndex, 1)
Department.Text = Cells(RowIndex, 2)
Department.Text = Cells(RowIndex, 3)
Department.Text = Cells(RowIndex, 4)
Department.Text = Cells(RowIndex, 5)
Department.Text = Cells(RowIndex, 6)
Department.Text = Cells(RowIndex, 7)
Department.Text = Cells(RowIndex, 8)
End Sub


--

Joe Mac
 
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
Retrieving data from one form to another John[_13_] New Users to Excel 1 January 22nd 08 03:10 PM
Retrieving Data from a worksheet to auto fill a user form mg_sv_r Excel Programming 1 January 16th 06 10:12 PM
Retrieving data from work sheet to USER FORM [email protected] Excel Programming 1 October 12th 05 12:51 AM
Retrieving Web POST data Seth[_8_] Excel Programming 2 August 30th 05 02:30 PM
outlook post form thru excel skells Excel Programming 0 June 11th 04 12:52 AM


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