Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Refer to Combo-box using a part + variable

I have 10 combo-boxes called:
CBoxOwner1, CBoxOwner2, CBoxOwner3 etc

I need to write the contents of each box (using a loop) to a sheet
using i as the loop variable to refer to the particular combo-box.
Obviously the segment:
CBoxOwner & i
doesn't work to refer to
CBoxOwner1
when i = 1 etc

For i = 1 To 10
Cells(i + 2, 3) = frmTransportRequest.CBoxOwner & i
Next i

Is it possible to do this within a loop?

Peter



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Refer to Combo-box using a part + variable

Peter,

Try

Dim i As Integer
For i = 1 To 10
Cells(i,1).Value = frmTransportRequest.Controls("CBoxOwner" &
i).Text
Next i


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Peter" wrote in message
...
I have 10 combo-boxes called:
CBoxOwner1, CBoxOwner2, CBoxOwner3 etc

I need to write the contents of each box (using a loop) to a

sheet
using i as the loop variable to refer to the particular

combo-box.
Obviously the segment:
CBoxOwner & i
doesn't work to refer to
CBoxOwner1
when i = 1 etc

For i = 1 To 10
Cells(i + 2, 3) = frmTransportRequest.CBoxOwner & i
Next i

Is it possible to do this within a loop?

Peter





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Refer to Combo-box using a part + variable

Thanks Chip
I will give it a try.
Peter

Chip Pearson wrote in message
...
Peter,

Try

Dim i As Integer
For i = 1 To 10
Cells(i,1).Value = frmTransportRequest.Controls("CBoxOwner" &
i).Text
Next i


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Peter" wrote in message
...
I have 10 combo-boxes called:
CBoxOwner1, CBoxOwner2, CBoxOwner3 etc

I need to write the contents of each box (using a loop) to a

sheet
using i as the loop variable to refer to the particular

combo-box.
Obviously the segment:
CBoxOwner & i
doesn't work to refer to
CBoxOwner1
when i = 1 etc

For i = 1 To 10
Cells(i + 2, 3) = frmTransportRequest.CBoxOwner & i
Next i

Is it possible to do this within a loop?

Peter







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Refer to Combo-box using a part + variable

Yep, it does the trick.

Thanks so much, Chip

Peter

Chip Pearson wrote in message
...
Peter,

Try

Dim i As Integer
For i = 1 To 10
Cells(i,1).Value = frmTransportRequest.Controls("CBoxOwner" &
i).Text
Next i


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Peter" wrote in message
...
I have 10 combo-boxes called:
CBoxOwner1, CBoxOwner2, CBoxOwner3 etc

I need to write the contents of each box (using a loop) to a

sheet
using i as the loop variable to refer to the particular

combo-box.
Obviously the segment:
CBoxOwner & i
doesn't work to refer to
CBoxOwner1
when i = 1 etc

For i = 1 To 10
Cells(i + 2, 3) = frmTransportRequest.CBoxOwner & i
Next i

Is it possible to do this within a loop?

Peter







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
Making part of a formula a variable Will Fleenor Excel Worksheet Functions 2 August 14th 09 01:19 PM
Refer cell value as part of formula Abhay Excel Worksheet Functions 1 March 18th 09 08:48 AM
Reference to a Variable Part of a Cell Hilvert Scheper Excel Worksheet Functions 7 September 3rd 08 11:40 AM
Variable Input Range for Combo Box Defoes Right Boot Excel Worksheet Functions 2 July 20th 05 03:44 PM
variable to refer to "this worksheet"? confused Excel Worksheet Functions 1 June 16th 05 11:51 PM


All times are GMT +1. The time now is 07:35 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"