Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default text box to tell form how many lines to unhide

I have a form for end users that gives them the ability to show 1-250 lines,
depending on how many changes need to be made. This is controled by a
userform with a text box asking them how many lines they would like. All 250
lines are there but not visible until they put a quantity in.

I have made a macro for every choice between 1 and 250 and sourced the
textbox to the each macro. Here is a sample of the macro:

Sub one()
'
' one Macro
' Macro recorded 10/14/2009 by tpeter
'

'
Rows("16:264").Select
Selection.EntireRow.Hidden = True
ActiveWindow.SmallScroll Down:=-21
End Sub

Here is a sample of the textbox sourcing:

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Range("m2").Value = TextBox1.Value

If Range("m2").Value = "1" Then
Call Unhide_Rows
Call one
End If

Is there a simpler way to do this, instead of making 250 macro's? Thanks for
your help.

Tim Peter
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default text box to tell form how many lines to unhide

Why not eliminate all the buttons and just ask the user how many rows to
reveal (perhaps in response to a CommandButton Click event)? I'm thinking of
something like this...

Dim Response As String
Response = InputBox("How many rows should be visible?")
If IsNumeric(Response) Then
If CLng(Response) 0 And CLng(Response) <= 250 Then
Rows(15).Resize(250).Hidden = True
Rows(15).Resize(Response).Hidden = False
End If
End If

--
Rick (MVP - Excel)


"tpeter" wrote in message
...
I have a form for end users that gives them the ability to show 1-250
lines,
depending on how many changes need to be made. This is controled by a
userform with a text box asking them how many lines they would like. All
250
lines are there but not visible until they put a quantity in.

I have made a macro for every choice between 1 and 250 and sourced the
textbox to the each macro. Here is a sample of the macro:

Sub one()
'
' one Macro
' Macro recorded 10/14/2009 by tpeter
'

'
Rows("16:264").Select
Selection.EntireRow.Hidden = True
ActiveWindow.SmallScroll Down:=-21
End Sub

Here is a sample of the textbox sourcing:

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Range("m2").Value = TextBox1.Value

If Range("m2").Value = "1" Then
Call Unhide_Rows
Call one
End If

Is there a simpler way to do this, instead of making 250 macro's? Thanks
for
your help.

Tim Peter


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 to unhide rows in Excel form? MWL Excel Discussion (Misc queries) 1 February 12th 09 03:47 PM
Hide/Unhide Form Control qwerty[_2_] Excel Programming 2 August 6th 06 06:27 PM
Hide/Unhide Sheets Form dbarelli[_18_] Excel Programming 3 August 1st 06 03:09 PM
Lines separating rows and columns won't unhide [email protected] Excel Discussion (Misc queries) 3 November 2nd 05 03:49 AM
excel97 vba to append lines to text file overwriting last 2 lines Paul Excel Programming 1 November 6th 04 08:11 PM


All times are GMT +1. The time now is 11:31 PM.

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

About Us

"It's about Microsoft Excel"