ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   same row different column (https://www.excelbanter.com/excel-programming/376293-same-row-different-column.html)

JustLearning

same row different column
 
Hi,

I have been looking every where for answers, still learning!!

I have numbers in column A and need to lookup a certain value, from a
userform the number that needs to be looked up should be entered in textbox1
and on the same userform another number is entered in textbox2. When
textbox1's number is found in column A the number in textbox2 should be
inserted in the same row but in column J.

Thanks in advance
Christiaan


Charles Chickering

same row different column
 
Dim r as range
set r = columns("A").Find(What:=TextBox1.Value)
r.Offset(,9) = TextBox2.Value
--
Charles Chickering

"A good example is twice the value of good advice."


"JustLearning" wrote:

Hi,

I have been looking every where for answers, still learning!!

I have numbers in column A and need to lookup a certain value, from a
userform the number that needs to be looked up should be entered in textbox1
and on the same userform another number is entered in textbox2. When
textbox1's number is found in column A the number in textbox2 should be
inserted in the same row but in column J.

Thanks in advance
Christiaan


JustLearning

same row different column
 
Thats great!!! But it gives an error when the number that is being searched
for is not in column A_ "Object variable or With block variable not set"

Much thanks


"Charles Chickering" wrote:

Dim r as range
set r = columns("A").Find(What:=TextBox1.Value)
r.Offset(,9) = TextBox2.Value
--
Charles Chickering

"A good example is twice the value of good advice."


"JustLearning" wrote:

Hi,

I have been looking every where for answers, still learning!!

I have numbers in column A and need to lookup a certain value, from a
userform the number that needs to be looked up should be entered in textbox1
and on the same userform another number is entered in textbox2. When
textbox1's number is found in column A the number in textbox2 should be
inserted in the same row but in column J.

Thanks in advance
Christiaan


Charles Chickering

same row different column
 
After the .Find statement use this line of code:
If r Is Nothing Then Exit Sub
--
Charles Chickering

"A good example is twice the value of good advice."


"JustLearning" wrote:

Thats great!!! But it gives an error when the number that is being searched
for is not in column A_ "Object variable or With block variable not set"

Much thanks


"Charles Chickering" wrote:

Dim r as range
set r = columns("A").Find(What:=TextBox1.Value)
r.Offset(,9) = TextBox2.Value
--
Charles Chickering

"A good example is twice the value of good advice."


"JustLearning" wrote:

Hi,

I have been looking every where for answers, still learning!!

I have numbers in column A and need to lookup a certain value, from a
userform the number that needs to be looked up should be entered in textbox1
and on the same userform another number is entered in textbox2. When
textbox1's number is found in column A the number in textbox2 should be
inserted in the same row but in column J.

Thanks in advance
Christiaan


[email protected]

same row different column
 


"JustLearning" wrote:

Hi,

I have been looking every where for answers, still learning!!

I have numbers in column A and need to lookup a certain value, from a
userform the number that needs to be looked up should be entered in textbox1
and on the same userform another number is entered in textbox2. When
textbox1's number is found in column A the number in textbox2 should be
inserted in the same row but in column J.

Thanks in advance
Christiaan



All times are GMT +1. The time now is 04:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com