Using a variable in a Rows Hidden Staement

M

Mark Dullingham

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
 
M

Mark Dullingham

That did the trick

Thank you very much

Mark

Barb Reinhardt said:
Try

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

Mark Dullingham said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top