Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to enter a Range of TextBoxes?

Here is my redundant code,

TextBox1.Visible = False
TextBox2.Visible = False
TextBox3.Visible = False
TextBox4.Visible = False
TextBox5.Visible = False
TextBox6.Visible = False
TextBox7.Visible = False
TextBox8.Visible = False
TextBox9.Visible = False
TextBox10.Visible = False
TextBox11.Visible = False
TextBox12.Visible = False

Is there a easier way to enter a range of textboxes lik
(Textbox1:Textbox12).Visible = False. (This did not work).

P.S. - The textboxes are from the Control ToolBox

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default How to enter a Range of TextBoxes?

If they're located in a Userform:

Dim i As Long
For i = 1 to 12
Me.Controls("TextBox" & i).Visible = False
Next i

--
Regards,

Juan Pablo González

"bg18461 " wrote in message
...
Here is my redundant code,

TextBox1.Visible = False
TextBox2.Visible = False
TextBox3.Visible = False
TextBox4.Visible = False
TextBox5.Visible = False
TextBox6.Visible = False
TextBox7.Visible = False
TextBox8.Visible = False
TextBox9.Visible = False
TextBox10.Visible = False
TextBox11.Visible = False
TextBox12.Visible = False

Is there a easier way to enter a range of textboxes like
(Textbox1:Textbox12).Visible = False. (This did not work).

P.S. - The textboxes are from the Control ToolBox.


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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How to enter a Range of TextBoxes?

But as they are control tolbox textboxes use

Dim i As Long
For i = 1 To 12
Worksheets("Sheet1").OLEObjects("TextBox" & i).Visible = False
Next i


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Juan Pablo Gonzalez" wrote in message
...
If they're located in a Userform:

Dim i As Long
For i = 1 to 12
Me.Controls("TextBox" & i).Visible = False
Next i

--
Regards,

Juan Pablo González

"bg18461 " wrote in message
...
Here is my redundant code,

TextBox1.Visible = False
TextBox2.Visible = False
TextBox3.Visible = False
TextBox4.Visible = False
TextBox5.Visible = False
TextBox6.Visible = False
TextBox7.Visible = False
TextBox8.Visible = False
TextBox9.Visible = False
TextBox10.Visible = False
TextBox11.Visible = False
TextBox12.Visible = False

Is there a easier way to enter a range of textboxes like
(Textbox1:Textbox12).Visible = False. (This did not work).

P.S. - The textboxes are from the Control ToolBox.


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





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to enter a Range of TextBoxes?

Thanks for everyone's responses so far, I do appreciate it, now back t
the code.

Below shows the code and the error as I have it in my program, an
hints...

Private Sub OptionButton1_Click()
Dim i As Long
For i = 23 To 190
Worksheets("Sheet4").OLEObjects("Label" & i).Visible = False
Next i

ERROR:
Run-time error '9':
Subscript out of rang

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How to enter a Range of TextBoxes?

That would suggest that Sheet4 doesn't exits, or one of the Texboxes 23 to
190 doesn't exist. When it occurs, get the error in debug.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"bg18461 " wrote in message
...
Thanks for everyone's responses so far, I do appreciate it, now back to
the code.

Below shows the code and the error as I have it in my program, any
hints...

Private Sub OptionButton1_Click()
Dim i As Long
For i = 23 To 190
Worksheets("Sheet4").OLEObjects("Label" & i).Visible = False
Next i

ERROR:
Run-time error '9':
Subscript out of range


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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to enter a Range of TextBoxes?

Ok, I got rid of error 9 (subscript out of range) - wrong sheet name
however this error has been surplanted by 'Run-time error 438' - Objec
doesn't support this property or method.

Here is my code:

Dim i As Long
For i = 16 To 31
Worksheets("INSRD VEH PASS").OLEObjects("OptionButton" & i).BackColor
&HFFFF&
Next i

It appears to not like the OLEObjects method, but I cannot figure out
way around this. Any suggestions..

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

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 90
Default How to enter a Range of TextBoxes?

In article , bg18461
says...
Thanks for everyone's responses so far, I do appreciate it, now back to
the code.

Below shows the code and the error as I have it in my program, any
hints...

Private Sub OptionButton1_Click()
Dim i As Long
For i = 23 To 190
Worksheets("Sheet4").OLEObjects("Label" & i).Visible = False
Next i

ERROR:
Run-time error '9':
Subscript out of range


Weren't you working with Textboxes, not Labels? If there are fewer
labels then textboxes then you'll get that error.

See ya
Ken McLennan
Qld Australia
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to enter a Range of TextBoxes?

You are the man! Thanks for your help, it worked :)

--
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
How do I enter formula sum(range+range)*0.15 sumif(range=3) tkw Excel Discussion (Misc queries) 2 October 1st 09 09:17 PM
Enter Range holyman New Users to Excel 3 November 6th 07 04:49 PM
How do you enter input range for a histogram Irishrose28 Excel Discussion (Misc queries) 1 August 4th 06 02:41 PM
How do you enter input range for a histogram Irishrose28 Excel Discussion (Misc queries) 0 August 4th 06 02:21 PM
User must enter something in a range of cells Jugglertwo Excel Discussion (Misc queries) 4 July 27th 06 05:36 AM


All times are GMT +1. The time now is 02:19 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"