Hi,
Thank you in advance for your time.
I have a multi-page userform and I am having problems getting the result I am after.
I am trying to get the user to enter a four digit (numeric code) into a textbox and display the contents of that code in another textbox when the user clicks in another textbox.
I have 2 textboxes.
One textbox txt_SAC_No is for the user to enter a four digit numeric code, which should return the address in another textbox txt_Site_Address.
The lookup is located in a dynamic named range as SiteAddress which encompasses 20 columns. The first column has the code and the second column holds the actual address.
Included in the named range, I have set up a code of 0000 (zeros) and instead of having the address in it, I have a message in there to tell the user to manually type the address (overwriting the text message). The code, 0000, means that there is no pre-defined address.
I do not want the address to be updated in the source of the Vlookup as it is a ‘once only’ entry and unlikely to ever be used again.
I have searched on the web and attempted to adapt various codes, but I have been unable to get anything to work.
I have some sample code I have tried, but my attempt to adapt it to my needs has not been successful.
Worksheet where data is transferred is code named: ws_Incident_Details (which is actually sheet named “Incident Details” – but I’d like to use the ‘coded’ sheet name in case someone changes the name in the tab of the sheet
This is the current code I've tried to adapt, unsuccessfully 
Private Sub SAC_No_AfterUpdate()
'lookup value based on SacNo
With Me
.txt_Site_Address = Application.WorksheetFunction.VLookup(CLng(Me.txt_SAC_No), wsAlarmResponseList.Range("SiteAddress"), 2, 0)
End With
End Sub
Private Sub cmdTransferData_Click()
'**** This button will transfer the data to the spreadsheet in the next available row *************
Dim LastRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Incident Details")
'Find last empty row in sheet
LastRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
'ADDING DATA AS A NEW RECORD - How do I get the username automatically into Column E .. I tried username = ().range
Cells(LastRow + 1, 1).Value = txtSEC_INC_No.Value 'Column A
Cells(LastRow + 1, 2).Value = txt_Date_Recorded.Value 'Column B
Cells(LastRow + 1, 3).Value = txt_Time_Recorded.Value 'Column C
Cells(LastRow + 1, 4).Value = txt_INC_Recorded_By.Text 'Column D
Cells(LastRow + 1, 5).Value = Environ("UserName") 'Placeholder for auto UserID to populate 'Column E
Cells(LastRow + 1, 7).Value = txt_Inc_DATE.Value 'Column G
Cells(LastRow + 1, 8).Value = txt_INC_Time.Value 'Column H
Cells(LastRow + 1, 9).Value = lbl_Inc_Day.Value 'Column I in day format
Cells(LastRow + 1, 10).Value = txt_SAC_No.Value 'Column J
Cells(LastRow + 1, 11).Value = txt_Site_Address.Text 'Column K
‘Is this correct for clearing the textboxes after SAVE button has been clicked?
Me.txt_SAC_No.Value = ""
Me.txtSiteAddress.Value = ""
Me.txtSEC_INC_No.TabIndex = ""
Me.txt_Inc_DATE.TabIndex = ""
Me.txt_INC_Time.TabIndex = ""
Me.txt_INC_Recorded_By.TabIndex = ""
Me.txt_Brief_Description.TabIndex = ""
Me.txt_Event_Location.TabIndex = ""
Me.txt_Detailed_DESCRIP.TabIndex = ""
Me.txt_Action_Taken.TabIndex = ""
I know I have posted a post with similar request ... but nobody has looked at it, or responded to it so I thought that I'd re-post an abbreviated version and with only the one question. I can't find an option to delete the original post.
Thanking you in advance for your assistance 
Cheers,
TheShyButterfly.
Bookmarks