View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Barb Reinhardt Barb Reinhardt is offline
external usenet poster
 
Posts: 3,355
Default Using a variable in a Rows Hidden Staement

Try

Rows(hideStart & ":33").Hidden = True

"Mark Dullingham" wrote:

I want to hide a number of row in my work book and with help from a previous
post I can do this for a fixed number of rows

Rows ("5:7").Hidden = True

My new problem is in this instance the last row I want to hide is fixed bu
the first roe number is defined by the variable - hideStart in the code below

Private Sub Set_LanButton_Click()
Dim numStart&, numStop&, numCells&, lanStart&, hideStart

lanStart = Val(txtbxLanNumber.Value)
numStart = Val(txtbxOSNumber.Value)
numStop = Val(txtbxNumberOS.Value)
numCells = 7 + numStop
hideStart = numCells + 1

Range("C8").Value = numStart
Range("C9:C" & numCells).Formula = "=R[-1]C3+1"
Range("B8:B" & numCells) = Val(txtbxLanNumber.Value)
Application.CutCopyMode = False
'--- I need a statement here to hide rows
'the starting row reference being the variable hideStart
'and the last row is 33

Me.MultiPage1.Value = 4

End Sub

My attempt

Rows(hideStart:"33").Hiiden = True

returns a syntax error

Can anyone point me in the right direction please.

Thanks in advance

Mark