Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default 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
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
How do I fill a cell in a user form from a selection on same form? Terry Tipsy Excel Discussion (Misc queries) 4 June 11th 07 02:59 PM
User form to change manual field filter in pivot table bennyob Excel Discussion (Misc queries) 0 March 7th 07 01:00 PM
Detecting Input Change on User Form Don Wiss Excel Programming 3 December 2nd 03 02:09 AM
Edit worksheet while a user form is on? Huyeote Excel Programming 0 September 12th 03 04:05 AM
Activating a worksheet with a user form open on the screen KimberlyC Excel Programming 4 August 29th 03 08:44 PM


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