vba excel

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

TrustPilot

starstarstarstarstar Excellent

  • Home
  • Courses
  • Promotions
  • Schedule
  • Formats
  • Our Clients

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » VBA excel

VBA excel

resolvedResolved · Low Priority · Version 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:

Converting an American date format to European using Formula

Excel depending on your local setting will only pick up date values of the dd mmm yyyy oders as date type. If you import data from various sources including America their date order is different with data value in mmm dd yyyy, excel can only treat it as text indicated by left aligning it. To overcome this you have to do the the following.

1. Extract the date components mmm dd yyyy, by using the the Text functions LEFT, MID or RIGHT

2. Reorder dd mmm component and concatenate using "&" in the right order this will create a text string with the date in the right order it then needss to be converted to a value so excel can recognise it.

3. To convert to value encase in TEXT function.

4. Format to desired date format.

View all Excel hints and tips


Server loaded in 0.07 secs.