Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem with removing qoutes from string

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/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Problem with removing qoutes from string

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/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem with removing qoutes from string

Hi tom,

Thanks for the reply. I see where you are coming from. I have bee
trying to use your code to cover my problem but couldn't come up wit
the answer


Here is part of my original code:

If Txt_Height_A_1.Visible = True Then
Txt_Calc_Elev_HeightorDepth_1.Visible = True
Txt_Calc_Elev_Width_1.Visible = True
Txt_Calc_Mod_Qty_1.Visible = True
Worksheets("Solarfin").Range("f16").Value = "Calc Module Sizes
Qty"
Selection.Font.Bold = True
Cmd_Calc_1.Visible = True
Else
Txt_Calc_Elev_HeightorDepth_1.Visible = False
Txt_Calc_Elev_Width_1.Visible = False
Txt_Calc_Mod_Qty_1.Visible = False
Worksheets("Solarfin").Range("f16").Value = ""
Cmd_Calc_1.Visible = False
End If

This repeats 6 times. The 6 textboxes only need to be visible if
Txt_Height_A_1.Visible = True or Txt_Height_A_2.Visible = True etc.
"Txt_Height_A_#".visible = true does not work. any ideas

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem with removing qoutes from string

Hi tom,

Thanks for the reply. I see where you are coming from. I have been
trying to use your code to cover my problem but couldn't come up with
the answer


Here is part of my original code:

If Txt_Height_A_1.Visible = True Then
Txt_Calc_Elev_HeightorDepth_1.Visible = True
Txt_Calc_Elev_Width_1.Visible = True
Txt_Calc_Mod_Qty_1.Visible = True
Worksheets("Solarfin").Range("f16").Value = "Calc Module Sizes &
Qty"
Selection.Font.Bold = True
Cmd_Calc_1.Visible = True
Else
Txt_Calc_Elev_HeightorDepth_1.Visible = False
Txt_Calc_Elev_Width_1.Visible = False
Txt_Calc_Mod_Qty_1.Visible = False
Worksheets("Solarfin").Range("f16").Value = ""
Cmd_Calc_1.Visible = False
End If

This repeats 6 times. The 6 textboxes only need to be visible if
Txt_Height_A_1.Visible = True or Txt_Height_A_2.Visible = True etc.
"Txt_Height_A_#".visible = true does not work. any ideas?


---
Message posted from http://www.ExcelForum.com/

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem with removing qoutes from string

Hi tom,

Thanks for the reply. I see where you are coming from. I have bee
trying to use your code to cover my problem but couldn't come up wit
the answer


Here is part of my original code:

If Txt_Height_A_1.Visible = True Then
Txt_Calc_Elev_HeightorDepth_1.Visible = True
Txt_Calc_Elev_Width_1.Visible = True
Txt_Calc_Mod_Qty_1.Visible = True
Worksheets("Solarfin").Range("f16").Value = "Calc Module Sizes
Qty"
Selection.Font.Bold = True
Cmd_Calc_1.Visible = True
Else
Txt_Calc_Elev_HeightorDepth_1.Visible = False
Txt_Calc_Elev_Width_1.Visible = False
Txt_Calc_Mod_Qty_1.Visible = False
Worksheets("Solarfin").Range("f16").Value = ""
Cmd_Calc_1.Visible = False
End If

This repeats 6 times. The 6 textboxes only need to be visible if
Txt_Height_A_1.Visible = True or Txt_Height_A_2.Visible = True etc.
"Txt_Height_A_#".visible = true does not work. any ideas

--
Message posted from http://www.ExcelForum.com



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
Removing character in a string MikeL Excel Discussion (Misc queries) 2 December 3rd 09 08:11 PM
removing value within a string Jane Excel Worksheet Functions 13 February 23rd 07 03:57 AM
Please help with removing text string excelator Excel Discussion (Misc queries) 3 August 15th 06 12:08 AM
Removing Spaces from string katmando Excel Worksheet Functions 4 May 16th 06 02:16 PM
Where can I get UNLIMITED Excel stock qoutes? ZouBCivil Excel Discussion (Misc queries) 2 March 7th 05 04:42 AM


All times are GMT +1. The time now is 03:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"