View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_2027_] Rick Rothstein \(MVP - VB\)[_2027_] is offline
external usenet poster
 
Posts: 1
Default 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