G
gki
Hello All,
I am sure that you, guys, would know the answer to my question.
As I attached a sample of my database underneath, I would like t
populate the information belonging to each product ID when I click o
commandbutton on the userform.
So far I tried to run several programme codes with searching function
but I cannot make it correct....
The programme should look like as below
Dim a(20) As Variant b(20) Variant
Dim x As Integer, Column As Integer
x=1: column=74
Do Until IsEmpty(Sheets("Sheet1").Cells(2,Column))
If Sheets("Sheet1").Cells(1, Column).Value=txtcode.value Then
a(x)=Sheets("Sheet1").Cells(3, Column)
b(x)=Sheets("Sheet1").Cells(4, Column)
.....
x=x+1
End If
column=column+1
Loop
Dim c As Object, d As Object
For x=1 To 20
Set c=Userform1.Controls("txtco0" & x)
Set d = Userform1.Controls("txtdefinition0" & x)
c.Value=a(x)
d.Value=b(x)
Next x
Once it reach the empty cell, it should look for the next component.
I am sure that I am very close to the solution, but I am already blin
and tired....
I need to breathe. Please HELP!!!
Thanks for your time,
Looking forward to hear you soon,
Gk
Attachment filename: question.gif
Download attachment: http://www.excelforum.com/attachment.php?postid=62769
I am sure that you, guys, would know the answer to my question.
As I attached a sample of my database underneath, I would like t
populate the information belonging to each product ID when I click o
commandbutton on the userform.
So far I tried to run several programme codes with searching function
but I cannot make it correct....
The programme should look like as below
Dim a(20) As Variant b(20) Variant
Dim x As Integer, Column As Integer
x=1: column=74
Do Until IsEmpty(Sheets("Sheet1").Cells(2,Column))
If Sheets("Sheet1").Cells(1, Column).Value=txtcode.value Then
a(x)=Sheets("Sheet1").Cells(3, Column)
b(x)=Sheets("Sheet1").Cells(4, Column)
.....
x=x+1
End If
column=column+1
Loop
Dim c As Object, d As Object
For x=1 To 20
Set c=Userform1.Controls("txtco0" & x)
Set d = Userform1.Controls("txtdefinition0" & x)
c.Value=a(x)
d.Value=b(x)
Next x
Once it reach the empty cell, it should look for the next component.
I am sure that I am very close to the solution, but I am already blin
and tired....
I need to breathe. Please HELP!!!
Thanks for your time,
Looking forward to hear you soon,
Gk
Attachment filename: question.gif
Download attachment: http://www.excelforum.com/attachment.php?postid=62769