Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

STL - Formerly Best Training Solutions Through Learning
TrustPilot
Excellent
Request Callback We will call you back
0207 987 3777 Call for assistance
Your Basket Basket is empty
vba excel

ResolvedVersion 2003

Chris has attended:
Excel VBA Intro Intermediate course
Access Introduction course
Access Intermediate course

VBA excel

I have multiple text boxes and comboboxes that when completed by a user, i need to have an on-click command that copies each of the values to a row of cells in excel.

Currently I have code for each one. I would prefer to use a loop command.

RE: VBA excel

Hi Chris. I'm going to assume your user changes the values of the objects on the form, and then clicks "OK" and the values are copied to the Excel cells. If your textboxes and comboboxes are numbered squentially you could cycle through each one by changing the value as so:

For MyTextboxNumber = 1 To 10

TextBox[MyTextboxNumber]...

Next n

Alternatively, you can jump from textbox to textbox by looping through the TabIndex value of each object and copying the values to a variable.

Hope this helps,

Anthony

Mon 27 Apr 2009: Automatically marked as resolved.

Excel tip:

Create a unique items table from a duplicating table

1. Ensure that your list has column headings
2. Select the entire list
3. From the menu bar, select DATA, FILTER, ADVANCED FILTER
4. Select "Filter the list, in place", and tick the "Unique Records Only" box
5. Click OK, filtered list appears.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.08 secs.