Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I cycle through buttons in a FOR loop?
I've got this piece of code which is obsiously not working:
For i = 1 To Worksheets.Count TempForm.CommandButton & i & .Caption = Worksheets(i).Name Next i But I need to assign different captions based on sheet names.. How do I achieve that? Cheers, Morris |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I cycle through buttons in a FOR loop?
try this
Sub getworksheetname() For Each Myworksheet In ThisWorkbook.Worksheets myname = Myworksheet.Name Next Myworksheet End Sub But I need to assign different captions based on sheet names.. How do I achieve that? Cheers, Morris |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I cycle through buttons in a FOR loop?
Assuming TempForm is a UserForm with CommandButtons:
On Error Resume Next For i = 1 To Worksheets.Count TempForm.Controls("CommandButton" & i).Caption = Worksheets(i).Name Next i Hth, Merjet |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I make a graph with 2-cycle X 3-cycle log-log graph paper? | Charts and Charting in Excel | |||
how to loop through option buttons | Excel Discussion (Misc queries) | |||
How do I keep result from 1 iteration cycle to use in next cycle? | Excel Discussion (Misc queries) | |||
How do I cycle through all of the worksheets | Excel Discussion (Misc queries) | |||
How to cycle through a series of similar objects with a for-next loop? | Excel Programming |