Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is it possible to loop through text?
Is it possible to loop through text, as it would for number? For example:
Dim Text As Integer ' where Text = "Before", "Now", or "After" For Text ' code goes here ' i.e. Me.Controls("txt" & Text).Visible = True Next Text |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is it possible to loop through text?
Dim sText As String
Dim ary As Variant Dim i As Long sText = "Before,Now,After" ary = Split(sText, ",") For i = LBound(ary) To UBound(ary) 'Me.Controls("txt" & ary(i)).Visible = True -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Sam Kuo" wrote in message ... Is it possible to loop through text, as it would for number? For example: Dim Text As Integer ' where Text = "Before", "Now", or "After" For Text ' code goes here ' i.e. Me.Controls("txt" & Text).Visible = True Next Text |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is it possible to loop through text?
It can be done this way also...
Dim V As Variant For Each V In Split("Before,Now,After", ",") Me.Controls("txt" & V).Visible = True Next Rick "Bob Phillips" wrote in message ... Dim sText As String Dim ary As Variant Dim i As Long sText = "Before,Now,After" ary = Split(sText, ",") For i = LBound(ary) To UBound(ary) 'Me.Controls("txt" & ary(i)).Visible = True -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Sam Kuo" wrote in message ... Is it possible to loop through text, as it would for number? For example: Dim Text As Integer ' where Text = "Before", "Now", or "After" For Text ' code goes here ' i.e. Me.Controls("txt" & Text).Visible = True Next Text |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Is it possible to loop through text?
Hi Bob and Rick
Thanks alot! "Rick Rothstein (MVP - VB)" wrote: It can be done this way also... Dim V As Variant For Each V In Split("Before,Now,After", ",") Me.Controls("txt" & V).Visible = True Next Rick "Bob Phillips" wrote in message ... Dim sText As String Dim ary As Variant Dim i As Long sText = "Before,Now,After" ary = Split(sText, ",") For i = LBound(ary) To UBound(ary) 'Me.Controls("txt" & ary(i)).Visible = True -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Sam Kuo" wrote in message ... Is it possible to loop through text, as it would for number? For example: Dim Text As Integer ' where Text = "Before", "Now", or "After" For Text ' code goes here ' i.e. Me.Controls("txt" & Text).Visible = True Next Text |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Worksheet loop not replacing new text | Excel Programming | |||
VBA Loop Formatting Text Question | Excel Programming | |||
Msg Box on each Loop to Replace text | Excel Programming | |||
Forms - Loop thru text boxes | Excel Programming | |||
End a loop if text is not found | Excel Programming |