Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Multiple Controls in a Dynamic UserForm

Hello All,

This week's stumbling block concerns a form that I've built
programmatically. Let's say it looks like this:

Name1 | Date 1 | | Comments |
Name2 | Date 2 | X | Comments |
Name3 | Date 3 | | Comments |
Name4 | Date 4 | X | Comments |
Name5 | Date 5 | X | Comments |
Name6 | Date 6 | | Comments |

When the user hits Save I want it to cycle through the third column of
ComboBoxes and wherever there's an "X" write the values of the first,
second and fourth columns to cells in a spreadsheet.

When I build the form, I namestamp each ComboBox with an R1C1 format
(in the .Name property), so Name1 in my example will be named CBR1C1,
Date 3 will be CBR3C2, etc.

Currently, I'm cycling through all the controls in the corresponding
frame with a For Each loop to find any that have a .Name ending with
"3" (to indicate the third column) and is populated (i.e. with an "X").

As I go through, I find the "X", use InStr and Mid on its .Name to get
the current row number and feed this back to try and get the
corresponding Name, Date and Comment from columns 1, 2 and 4. I suspect
that this is my problem; as I'm within a loop that is cycling through
each control on a particular frame, I'm locked into the particular
control and can't step out of it.

Anyone know a way of cycling through the third column of ComboBoxes and
when there's an "X" in it read the data from other columns?

FYI - I get an Object Variable Not Set Error. I've tried Set and With
to assign the .Name but with no luck.

Cheers,

Ross.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Multiple Controls in a Dynamic UserForm

No worries, have solved it. Just added an extra case to read in the
value of the first column (by looking for the "C1" at the end of the
name) as the loop cycles through, so when it gets to the column with
the "X" in it it has a value already there waiting which is overwritten
if not needed. Pretty obvious when you think about it! Probably the
result of working a 12 hour day with either too much or too little
coffee, not sure which yet.

Thanks for looking anyway,

Ross.

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
Can a Combobox in a Userform access multiple dynamic tables JackyJ Excel Discussion (Misc queries) 0 August 15th 10 01:19 AM
Userform for time entry: multiple controls/single value? smplogc Excel Programming 3 April 28th 06 12:09 AM
Dynamic controls Martin Walke Excel Programming 5 September 29th 04 12:15 PM
creating dynamic controls monika Excel Programming 0 April 1st 04 01:56 AM
Dynamic Label for Controls Rob Bovey Excel Programming 0 September 8th 03 06:47 PM


All times are GMT +1. The time now is 07:10 PM.

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

About Us

"It's about Microsoft Excel"