Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using user form to change cell value on worksheet
Hi,
I have a user form with the following code for looking up a cell value on my worksheet: TextBox2.Text = Application.VLookup(CDbl(ComboBox1.Text), _ Worksheets("Blending Details").Range("A2:Z500"), 2, False) Now if I was to type in a different value in text box 2 how would I write a code that would send the updated value back to the worksheet(("Blending Details").Range("A2:Z500"), 2,)? Regards gregork |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using user form to change cell value on worksheet
Untested, so watch for typos: Dim res As Variant Dim myRng As Range Set myRng = Worksheets("blending details").Range("a2:A500") res = Application.Match(CDbl(combobox1.Text), myRng, 0) If IsError(res) Then MsgBox "no match!" Else myRng(res).Offset(0, 1).Value = textbox2.text end if gregork wrote: Hi, I have a user form with the following code for looking up a cell value on my worksheet: TextBox2.Text = Application.VLookup(CDbl(ComboBox1.Text), _ Worksheets("Blending Details").Range("A2:Z500"), 2, False) Now if I was to type in a different value in text box 2 how would I write a code that would send the updated value back to the worksheet(("Blending Details").Range("A2:Z500"), 2,)? Regards gregork -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using user form to change cell value on worksheet
Dim rng as range, res as Variant, rng1 as Range
Set rng = Worksheets("Blending Details").Range("A2:A500") res = Application.Match(cDbl(combobox1.Text),rng,0) if not iserror(res) then set rng1 = rng(res) rng1.offset(0,1).Value = Textbox2.Text Else msgbox "No Match for " & Combobox1.Text End if -- Regards, Tom Ogilvy "gregork" wrote in message ... Hi, I have a user form with the following code for looking up a cell value on my worksheet: TextBox2.Text = Application.VLookup(CDbl(ComboBox1.Text), _ Worksheets("Blending Details").Range("A2:Z500"), 2, False) Now if I was to type in a different value in text box 2 how would I write a code that would send the updated value back to the worksheet(("Blending Details").Range("A2:Z500"), 2,)? Regards gregork |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using user form to change cell value on worksheet
Many thanks guys that was exactly what I was looking for.
Kind Regards gregork "gregork" wrote in message ... Hi, I have a user form with the following code for looking up a cell value on my worksheet: TextBox2.Text = Application.VLookup(CDbl(ComboBox1.Text), _ Worksheets("Blending Details").Range("A2:Z500"), 2, False) Now if I was to type in a different value in text box 2 how would I write a code that would send the updated value back to the worksheet(("Blending Details").Range("A2:Z500"), 2,)? Regards gregork |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I fill a cell in a user form from a selection on same form? | Excel Discussion (Misc queries) | |||
User form to change manual field filter in pivot table | Excel Discussion (Misc queries) | |||
Detecting Input Change on User Form | Excel Programming | |||
Edit worksheet while a user form is on? | Excel Programming | |||
Activating a worksheet with a user form open on the screen | Excel Programming |