Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm having a persistant problem with trying to code what I want.
What I have is a list of names(A2:A82), and a UserForm that lets me include one of these names(textBox1). It also has 4 values associated with the name. WHen I click the command button, I want to have it find the name i've included (textBox1) within the list of names (A2:A82) Then I want it to past the 4 values across the next 4 colums in the same row. I think it'll be a loop, but I don't know how. ++++Here follows an example++++ so I have: Ben Mary James Billy Bob Rudy Frank Hanz I input "Billy" into my form, and then have values 20, 5, 5 and 0 in other text boxes. when I click a button to enter the data, it will look down the list of names, find that billy is in Row 4, then it will copy the 20 in the next column, the 5 in the next column and the 0 in the last column. I'm really frustrated with this, because it seems so straight forward and I can't do it. I hate being new to something... |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub CommandButton1_Click()
Dim i As Integer For i = 2 To 82 If Cells(i, 1) = TextBox1 Then Cells (i, 2) = TextBox2 Cells (i, 3) = TextBox3 Cells (i, 4) = TextBox4 Cells (i, 5) = TextBox5 End If Next End Sub You could also use the Find method but the above will probably be easier for you to understand and modify as needed. -- Vasant "Adeptus - ExcelForums.com" wrote in message ... I'm having a persistant problem with trying to code what I want. What I have is a list of names(A2:A82), and a UserForm that lets me include one of these names(textBox1). It also has 4 values associated with the name. WHen I click the command button, I want to have it find the name i've included (textBox1) within the list of names (A2:A82) Then I want it to past the 4 values across the next 4 colums in the same row. I think it'll be a loop, but I don't know how. ++++Here follows an example++++ so I have: Ben Mary James Billy Bob Rudy Frank Hanz I input "Billy" into my form, and then have values 20, 5, 5 and 0 in other text boxes. when I click a button to enter the data, it will look down the list of names, find that billy is in Row 4, then it will copy the 20 in the next column, the 5 in the next column and the 0 in the last column. I'm really frustrated with this, because it seems so straight forward and I can't do it. I hate being new to something... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to Loop some code | Excel Discussion (Misc queries) | |||
How to get my code to loop | Excel Programming | |||
Help with loop code... | Excel Programming | |||
Any Idea on how to modify this code relating to query??? | Excel Programming | |||
VBE code in a loop | Excel Programming |