![]() |
create a find button
I have created a custom user form to input data. Now I
need a macro that will search column A for example for the value which is input into text box 1, and furthermore, if the value entered in text box 1 is found, I need the cell values for that specific record to be displayed in the various text boxes on the user form for editting, like for example I have a user form: User Id, user name, user city 123, bob, kansas city I need to search for 123 and return all values (123, bob, kansas city) to text boxes on the user form so I can edit them and ultimately save the changes. |
create a find button
Dim rng as Range
with Worksheets("Sheet1").Columns(1) set rng = .find(what:=Userform1.Textbox1.Text, _ After:=Range(A65536), _ LookIn:=xlFormulas, _ LookAt:=xlWhole, _ SearchOrder:=xlByRows, _ SearchDirection:=xlNext, _ MatchCase:=False) End with If not rng is Nothing then With Userform1 .Textbox2.Text = rng.offset(0,1).Value .Textbox3.Text = rng.Offset(0,2).Value ' and so forth End with Else msgbox Userform1.Textbox1.Text & _ " was not found" End If -- Regards, Tom Ogilvy wrote in message ... I have created a custom user form to input data. Now I need a macro that will search column A for example for the value which is input into text box 1, and furthermore, if the value entered in text box 1 is found, I need the cell values for that specific record to be displayed in the various text boxes on the user form for editting, like for example I have a user form: User Id, user name, user city 123, bob, kansas city I need to search for 123 and return all values (123, bob, kansas city) to text boxes on the user form so I can edit them and ultimately save the changes. |
create a find button
Thank you for the repsonse...I am getting the error 1004
Method 'Range' of object '_Global' failed -----Original Message----- Dim rng as Range with Worksheets("Sheet1").Columns(1) set rng = .find(what:=Userform1.Textbox1.Text, _ After:=Range(A65536), _ LookIn:=xlFormulas, _ LookAt:=xlWhole, _ SearchOrder:=xlByRows, _ SearchDirection:=xlNext, _ MatchCase:=False) End with If not rng is Nothing then With Userform1 .Textbox2.Text = rng.offset(0,1).Value .Textbox3.Text = rng.Offset(0,2).Value ' and so forth End with Else msgbox Userform1.Textbox1.Text & _ " was not found" End If -- Regards, Tom Ogilvy wrote in message ... I have created a custom user form to input data. Now I need a macro that will search column A for example for the value which is input into text box 1, and furthermore, if the value entered in text box 1 is found, I need the cell values for that specific record to be displayed in the various text boxes on the user form for editting, like for example I have a user form: User Id, user name, user city 123, bob, kansas city I need to search for 123 and return all values (123, bob, kansas city) to text boxes on the user form so I can edit them and ultimately save the changes. . |
create a find button
see answer to your second posting on this topic. -- Regards, Tom Ogilvy wrote in message ... Thank you for the repsonse...I am getting the error 1004 Method 'Range' of object '_Global' failed -----Original Message----- Dim rng as Range with Worksheets("Sheet1").Columns(1) set rng = .find(what:=Userform1.Textbox1.Text, _ After:=Range(A65536), _ LookIn:=xlFormulas, _ LookAt:=xlWhole, _ SearchOrder:=xlByRows, _ SearchDirection:=xlNext, _ MatchCase:=False) End with If not rng is Nothing then With Userform1 .Textbox2.Text = rng.offset(0,1).Value .Textbox3.Text = rng.Offset(0,2).Value ' and so forth End with Else msgbox Userform1.Textbox1.Text & _ " was not found" End If -- Regards, Tom Ogilvy wrote in message ... I have created a custom user form to input data. Now I need a macro that will search column A for example for the value which is input into text box 1, and furthermore, if the value entered in text box 1 is found, I need the cell values for that specific record to be displayed in the various text boxes on the user form for editting, like for example I have a user form: User Id, user name, user city 123, bob, kansas city I need to search for 123 and return all values (123, bob, kansas city) to text boxes on the user form so I can edit them and ultimately save the changes. . |
All times are GMT +1. The time now is 12:04 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com