ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using a variable in a Rows Hidden Staement (https://www.excelbanter.com/excel-programming/386512-using-variable-rows-hidden-staement.html)

Mark Dullingham

Using a variable in a Rows Hidden Staement
 
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

Barb Reinhardt

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


Mark Dullingham

Using a variable in a Rows Hidden Staement
 
That did the trick

Thank you very much

Mark

"Barb Reinhardt" wrote:

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



All times are GMT +1. The time now is 07:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com