View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
tpeter tpeter is offline
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