Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Nested For Each Statement

I am attempting to loop through a list of intials on a hidden sheet and
assign each set of initials as a caption to an optionbutton in a group of
optionbuttons on a userform. I cannot get the loop sequence correct. I
have tried several variations of the code below, but I cannot get it to
change to the next optionbutton. Any help would be greatly appreciated. I
am using excel 97.

For i = 10 To 30
For Each icell In Range("InitialList")
If Not IsEmpty(icell) Then
BillTrackingForm.Controls("OptionButton" & i).Caption = icell.Text
BillTrackingForm.Controls("OptionButton" & i).Enabled = True
End If
Next icell
Next i


  #2   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 232
Default Nested For Each Statement

what do you mean it won't change to the next option button?
do you recieve any error messages? do you have any error handling code in
your routine? (even On Error Resume Next?)
Ben

--
When you lose your mind, you free your life.


"V. Roe" wrote:

I am attempting to loop through a list of intials on a hidden sheet and
assign each set of initials as a caption to an optionbutton in a group of
optionbuttons on a userform. I cannot get the loop sequence correct. I
have tried several variations of the code below, but I cannot get it to
change to the next optionbutton. Any help would be greatly appreciated. I
am using excel 97.

For i = 10 To 30
For Each icell In Range("InitialList")
If Not IsEmpty(icell) Then
BillTrackingForm.Controls("OptionButton" & i).Caption = icell.Text
BillTrackingForm.Controls("OptionButton" & i).Enabled = True
End If
Next icell
Next i



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default Nested For Each Statement

"I am attempting to loop through a list of intials on a hidden sheet and
assign each set of initials as a caption to an optionbutton "...
Question: Do certain buttons get certain initials, or do you want to
concatenate all the initials onto each button's caption?
In any event, the problem with your current loop is that while you loop
properly through the cells in InitialList, you always overwrite your prior
caption with the new icell.Text, so at the end the only thing showing (I
presume) is the last initial in the list.
If what you want to do is concatenate those initials, use
BillTrackingForm.Controls("OptionButton" & i).Caption =
BillTrackingForm.Controls("OptionButton" & i).Caption & icell.Text

--
- K Dales


"V. Roe" wrote:

I am attempting to loop through a list of intials on a hidden sheet and
assign each set of initials as a caption to an optionbutton in a group of
optionbuttons on a userform. I cannot get the loop sequence correct. I
have tried several variations of the code below, but I cannot get it to
change to the next optionbutton. Any help would be greatly appreciated. I
am using excel 97.

For i = 10 To 30
For Each icell In Range("InitialList")
If Not IsEmpty(icell) Then
BillTrackingForm.Controls("OptionButton" & i).Caption = icell.Text
BillTrackingForm.Controls("OptionButton" & i).Enabled = True
End If
Next icell
Next i



  #4   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 232
Default Nested For Each Statement

something i just noticed about your code.
The way you have the for next loops set up. each cell will change each
optionbutton NUMEROUS TIMES. optionbutton10 will change for how many ever
cells you have in your "InitialList" range. are you trying to assign each
cell taht contains a SINGLE SET OF initials to a SINGLE Option Button?
Ben
--
When you lose your mind, you free your life.


"V. Roe" wrote:

I am attempting to loop through a list of intials on a hidden sheet and
assign each set of initials as a caption to an optionbutton in a group of
optionbuttons on a userform. I cannot get the loop sequence correct. I
have tried several variations of the code below, but I cannot get it to
change to the next optionbutton. Any help would be greatly appreciated. I
am using excel 97.

For i = 10 To 30
For Each icell In Range("InitialList")
If Not IsEmpty(icell) Then
BillTrackingForm.Controls("OptionButton" & i).Caption = icell.Text
BillTrackingForm.Controls("OptionButton" & i).Enabled = True
End If
Next icell
Next i



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Nested For Each Statement

Yes I am trying to set a single optionbutton to a single set of initials. I
want the user to select their intials using the optionbutton.
Thank you
"ben" (remove this if mailing direct) wrote in message
...
something i just noticed about your code.
The way you have the for next loops set up. each cell will change each
optionbutton NUMEROUS TIMES. optionbutton10 will change for how many ever
cells you have in your "InitialList" range. are you trying to assign each
cell taht contains a SINGLE SET OF initials to a SINGLE Option Button?
Ben
--
When you lose your mind, you free your life.


"V. Roe" wrote:

I am attempting to loop through a list of intials on a hidden sheet and
assign each set of initials as a caption to an optionbutton in a group

of
optionbuttons on a userform. I cannot get the loop sequence correct. I
have tried several variations of the code below, but I cannot get it to
change to the next optionbutton. Any help would be greatly appreciated.

I
am using excel 97.

For i = 10 To 30
For Each icell In Range("InitialList")
If Not IsEmpty(icell) Then
BillTrackingForm.Controls("OptionButton" & i).Caption = icell.Text
BillTrackingForm.Controls("OptionButton" & i).Enabled = True
End If
Next icell
Next i







  #6   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 232
Default Nested For Each Statement

try this

i = 10
For Each icell In Range("InitialList")
If Not IsEmpty(icell) Then
BillTrackingForm.Controls("OptionButton" & i).Caption = icell.Text
BillTrackingForm.Controls("OptionButton" & i).Enabled = True
i = i +1
End If
Next icell




--
When you lose your mind, you free your life.


"V. Roe" wrote:

Yes I am trying to set a single optionbutton to a single set of initials. I
want the user to select their intials using the optionbutton.
Thank you
"ben" (remove this if mailing direct) wrote in message
...
something i just noticed about your code.
The way you have the for next loops set up. each cell will change each
optionbutton NUMEROUS TIMES. optionbutton10 will change for how many ever
cells you have in your "InitialList" range. are you trying to assign each
cell taht contains a SINGLE SET OF initials to a SINGLE Option Button?
Ben
--
When you lose your mind, you free your life.


"V. Roe" wrote:

I am attempting to loop through a list of intials on a hidden sheet and
assign each set of initials as a caption to an optionbutton in a group

of
optionbuttons on a userform. I cannot get the loop sequence correct. I
have tried several variations of the code below, but I cannot get it to
change to the next optionbutton. Any help would be greatly appreciated.

I
am using excel 97.

For i = 10 To 30
For Each icell In Range("InitialList")
If Not IsEmpty(icell) Then
BillTrackingForm.Controls("OptionButton" & i).Caption = icell.Text
BillTrackingForm.Controls("OptionButton" & i).Enabled = True
End If
Next icell
Next i






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Nested For Each Statement

Thanks so much that worked perfectly. I've spent hours trying to figure
this out.

"ben" (remove this if mailing direct) wrote in message
...
try this

i = 10
For Each icell In Range("InitialList")
If Not IsEmpty(icell) Then
BillTrackingForm.Controls("OptionButton" & i).Caption = icell.Text
BillTrackingForm.Controls("OptionButton" & i).Enabled = True
i = i +1
End If
Next icell




--
When you lose your mind, you free your life.


"V. Roe" wrote:

Yes I am trying to set a single optionbutton to a single set of

initials. I
want the user to select their intials using the optionbutton.
Thank you
"ben" (remove this if mailing direct) wrote in

message
...
something i just noticed about your code.
The way you have the for next loops set up. each cell will change each
optionbutton NUMEROUS TIMES. optionbutton10 will change for how many

ever
cells you have in your "InitialList" range. are you trying to assign

each
cell taht contains a SINGLE SET OF initials to a SINGLE Option Button?
Ben
--
When you lose your mind, you free your life.


"V. Roe" wrote:

I am attempting to loop through a list of intials on a hidden sheet

and
assign each set of initials as a caption to an optionbutton in a

group
of
optionbuttons on a userform. I cannot get the loop sequence

correct. I
have tried several variations of the code below, but I cannot get it

to
change to the next optionbutton. Any help would be greatly

appreciated.
I
am using excel 97.

For i = 10 To 30
For Each icell In Range("InitialList")
If Not IsEmpty(icell) Then
BillTrackingForm.Controls("OptionButton" & i).Caption = icell.Text
BillTrackingForm.Controls("OptionButton" & i).Enabled = True
End If
Next icell
Next i








  #8   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 232
Default Nested For Each Statement

K.I.S.S.
We must live by that :)
Ben

--
When you lose your mind, you free your life.


"V. Roe" wrote:

Thanks so much that worked perfectly. I've spent hours trying to figure
this out.

"ben" (remove this if mailing direct) wrote in message
...
try this

i = 10
For Each icell In Range("InitialList")
If Not IsEmpty(icell) Then
BillTrackingForm.Controls("OptionButton" & i).Caption = icell.Text
BillTrackingForm.Controls("OptionButton" & i).Enabled = True
i = i +1
End If
Next icell




--
When you lose your mind, you free your life.


"V. Roe" wrote:

Yes I am trying to set a single optionbutton to a single set of

initials. I
want the user to select their intials using the optionbutton.
Thank you
"ben" (remove this if mailing direct) wrote in

message
...
something i just noticed about your code.
The way you have the for next loops set up. each cell will change each
optionbutton NUMEROUS TIMES. optionbutton10 will change for how many

ever
cells you have in your "InitialList" range. are you trying to assign

each
cell taht contains a SINGLE SET OF initials to a SINGLE Option Button?
Ben
--
When you lose your mind, you free your life.


"V. Roe" wrote:

I am attempting to loop through a list of intials on a hidden sheet

and
assign each set of initials as a caption to an optionbutton in a

group
of
optionbuttons on a userform. I cannot get the loop sequence

correct. I
have tried several variations of the code below, but I cannot get it

to
change to the next optionbutton. Any help would be greatly

appreciated.
I
am using excel 97.

For i = 10 To 30
For Each icell In Range("InitialList")
If Not IsEmpty(icell) Then
BillTrackingForm.Controls("OptionButton" & i).Caption = icell.Text
BillTrackingForm.Controls("OptionButton" & i).Enabled = True
End If
Next icell
Next i









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
IF Statement or nested IF Rahim Excel Worksheet Functions 4 October 5th 09 04:04 PM
Nested IF/OR/AND Statement Help Gayla Excel Worksheet Functions 3 June 22nd 07 04:27 AM
Nested IF Statement Secret Squirrel Excel Discussion (Misc queries) 8 November 19th 06 02:43 AM
Nested IF Statement aposatsk Excel Discussion (Misc queries) 1 August 1st 06 05:19 PM
Nested IF statement jgannon Excel Discussion (Misc queries) 3 November 22nd 05 11:55 PM


All times are GMT +1. The time now is 01:28 AM.

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"