Sub Tester1()
Dim obj As OLEObject
Dim tbox As msforms.TextBox
For Each obj In ActiveSheet.OLEObjects
If TypeOf obj.Object Is msforms.TextBox Then
Set tbox = obj.Object
If tbox.Name Like "Txt_Calc_Elev_HeightorDepth_#" Then
obj.Visible = True
End If
End If
Next
End Sub
This assumes the name property of the control toolbox toolbar textboxes
(activeX) are actually Txt_Calc_Elev_HeightorDepth_1 through 6
worked for me.
--
Regards,
Tom Ogilvy
"suekay " wrote in message
...
Hi, Can anyone help me with this problem?
I have 6 textboxes that I want to make visible on the excel page by
using a For loop. However I am having a problem with the quotes
Code:
For ModuleNo = 1 To 6
StrTxtCalcElevHeightorDepth = ("Txt_Calc_Elev_HeightorDepth_" &
ModuleNo & "")
StrTxtCalcElevHeightorDepth.Visible = True
Next ModuleNo
Txt_Calc_Elev_HeightorDepth_1 is a textbox
The code above means that StrTxtCalcElevHeightorDepth =
"Txt_Calc_Elev_HeightorDepth_1". The quotes are causing a problem -
anyone know how to remove them?
thank you
---
Message posted from http://www.ExcelForum.com/