Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Enter data in correct row from form

Hi guys need your expert help again.

I have created a form that takes a part number and looks this up in a range
and fills the remaining text boxes on the form. So far so good.

What I want to do is, if the user alters the data return this to the row
where I first looked up the original data.

I've searched through but can't find a way of doing it.

my code so far:
TextBox2.Value = Application.VLookup(TextBox1.Value, Sheets("QKIT -
NET").Range("B2:G65536"), 3, False)
TextBox3.Value = Application.VLookup(TextBox1.Value, Sheets("QKIT -
NET").Range("B2:G65536"), 2, False)
TextBox4.Value = Application.VLookup(TextBox1.Value, Sheets("QKIT -
NET").Range("B2:G65536"), 4, False)
TextBox5.Value = Application.VLookup(TextBox1.Value, Sheets("QKIT -
NET").Range("B2:G65536"), 5, False)
TextBox6.Value = Application.VLookup(TextBox1.Value, Sheets("QKIT -
NET").Range("B2:G65536"), 6, False)


Then button 2 would use more code to overwrite the old data with the new.

TIA

Stu
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Enter data in correct row from form

Dim res as Variant
res = Application.Match(TextBox1.Value, Sheets("QKIT -
NET").Range("B2:G65536"), 0)
if not res is nothing then
set rng = Sheets("QKIT - NET").Range("B2:B65536")(res)
rng.offset(0,2) = TextBox2.Value
rng.offset(0,1) = TextBox3.Value
rng.offset(0,3) = TextBox4.Value
rng.offset(0,4) = TextBox5.Value
rng.offset(0,5) = TextBox6.Value
End if

--
Regards,
Tom Ogilvy

"Stuart" wrote:

Hi guys need your expert help again.

I have created a form that takes a part number and looks this up in a range
and fills the remaining text boxes on the form. So far so good.

What I want to do is, if the user alters the data return this to the row
where I first looked up the original data.

I've searched through but can't find a way of doing it.

my code so far:
TextBox2.Value = Application.VLookup(TextBox1.Value, Sheets("QKIT -
NET").Range("B2:G65536"), 3, False)
TextBox3.Value = Application.VLookup(TextBox1.Value, Sheets("QKIT -
NET").Range("B2:G65536"), 2, False)
TextBox4.Value = Application.VLookup(TextBox1.Value, Sheets("QKIT -
NET").Range("B2:G65536"), 4, False)
TextBox5.Value = Application.VLookup(TextBox1.Value, Sheets("QKIT -
NET").Range("B2:G65536"), 5, False)
TextBox6.Value = Application.VLookup(TextBox1.Value, Sheets("QKIT -
NET").Range("B2:G65536"), 6, False)


Then button 2 would use more code to overwrite the old data with the new.

TIA

Stu

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Enter data in correct row from form

Tom,
thanks for the info it's much appreciated however bearing in mind you are
helping very much a novice...

I presume that line 2 and 3 have to be joined because of the message limits
but what about line 4/5?

If I join them Vba complains 'end if without block if' and if i don't it
tells me it needs an object?

Stu

"Tom Ogilvy" wrote:

Dim res as Variant
res = Application.Match(TextBox1.Value, Sheets("QKIT -
NET").Range("B2:G65536"), 0)
if not res is nothing then
set rng = Sheets("QKIT - NET").Range("B2:B65536")(res)
rng.offset(0,2) = TextBox2.Value
rng.offset(0,1) = TextBox3.Value
rng.offset(0,3) = TextBox4.Value
rng.offset(0,4) = TextBox5.Value
rng.offset(0,5) = TextBox6.Value
End if

--
Regards,
Tom Ogilvy

"Stuart" wrote:

Hi guys need your expert help again.

I have created a form that takes a part number and looks this up in a range
and fills the remaining text boxes on the form. So far so good.

What I want to do is, if the user alters the data return this to the row
where I first looked up the original data.

I've searched through but can't find a way of doing it.

my code so far:
TextBox2.Value = Application.VLookup(TextBox1.Value, Sheets("QKIT -
NET").Range("B2:G65536"), 3, False)
TextBox3.Value = Application.VLookup(TextBox1.Value, Sheets("QKIT -
NET").Range("B2:G65536"), 2, False)
TextBox4.Value = Application.VLookup(TextBox1.Value, Sheets("QKIT -
NET").Range("B2:G65536"), 4, False)
TextBox5.Value = Application.VLookup(TextBox1.Value, Sheets("QKIT -
NET").Range("B2:G65536"), 5, False)
TextBox6.Value = Application.VLookup(TextBox1.Value, Sheets("QKIT -
NET").Range("B2:G65536"), 6, False)


Then button 2 would use more code to overwrite the old data with the new.

TIA

Stu

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
Form to enter data into excel Nurse Louise New Users to Excel 1 July 1st 21 11:33 AM
Creating an Form to enter data Louisq Excel Discussion (Misc queries) 3 October 27th 08 08:16 PM
Creating a form to enter data DanielWalters6 New Users to Excel 6 June 13th 08 07:35 PM
Create a form in excel so I can enter data using DataForm Lynn Excel Discussion (Misc queries) 2 February 14th 07 06:35 PM
Can I use a FORM to enter data if I have more than the 32 fields? Graciemygirl Excel Discussion (Misc queries) 3 March 23rd 06 11:01 PM


All times are GMT +1. The time now is 10:23 AM.

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"