Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default +++Help me with a loop... I have no idea what code I need!

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default +++Help me with a loop... I have no idea what code I need!

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
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 to Loop some code Phil Osman Excel Discussion (Misc queries) 2 August 19th 05 11:14 AM
How to get my code to loop Dominique Feteau[_2_] Excel Programming 5 December 17th 04 01:35 PM
Help with loop code... gaba Excel Programming 1 October 20th 04 01:37 PM
Any Idea on how to modify this code relating to query??? hce[_24_] Excel Programming 1 October 14th 04 12:27 PM
VBE code in a loop loloflores Excel Programming 0 April 30th 04 12:28 PM


All times are GMT +1. The time now is 05:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"