![]() |
vlookup function in VBA code
Hi Everyone
At first I had a code like following ' TextBox2 = Application.VLookup(TextBox1.Value, Sheet4.Range("staff"), 2) but that one does not work. Instead I modified like follows Private Sub CommandButton4_Click() TextBox2 = Application.VLookup(Sheet4.Range("g4"), Sheet4.Range("staff"), 2) End Sub Private Sub TextBox1_Change() Sheet4.Range("G4") = TextBox1.Value End Sub in that case it worked well. But why my first code did not work?Any idea? Thanks for the help... Have a good day |
vlookup function in VBA code
Try with a sheet specification, e.g.
TextBox2 = Application.VLookup(Activesheet.TextBox1.Value,She et4.Range("staff"), 2) Regards, Stefi €ť ezt Ă*rta: Hi Everyone At first I had a code like following ' TextBox2 = Application.VLookup(TextBox1.Value, Sheet4.Range("staff"), 2) but that one does not work. Instead I modified like follows Private Sub CommandButton4_Click() TextBox2 = Application.VLookup(Sheet4.Range("g4"), Sheet4.Range("staff"), 2) End Sub Private Sub TextBox1_Change() Sheet4.Range("G4") = TextBox1.Value End Sub in that case it worked well. But why my first code did not work?Any idea? Thanks for the help... Have a good day |
vlookup function in VBA code
On Aug 5, 9:40*pm, Stefi wrote:
Try with a sheet specification, e.g. TextBox2 = Application.VLookup(Activesheet.TextBox1.Value,She et4.Range("staff"), 2) Regards, Stefi ” ezt írta: Hi Everyone At first I had a code like following ' TextBox2 = Application.VLookup(TextBox1.Value, Sheet4.Range("staff"), 2) but that one does not work. Instead I modified like follows Private Sub CommandButton4_Click() TextBox2 = Application.VLookup(Sheet4.Range("g4"), Sheet4.Range("staff"), 2) End Sub Private Sub TextBox1_Change() Sheet4.Range("G4") = TextBox1.Value End Sub in that case it worked well. But why my first code did not work?Any idea? Thanks for the help... Have a good day- Hide quoted text - - Show quoted text - Sorry I forgot to mention those textbox are in the userform. thanks for the reply |
All times are GMT +1. The time now is 01:54 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com