I'm trying to write a VBA Code in excel to hide rows based off values from another worksheet. I'm have been able to load the values into a variable fine however I am having issues with the range line, Below is my code so far.
Any Help would be great, when I run the above I get
"Method 'Range' of object'_Global' Failed
I have also tried Rows as well with no luck
Code:
Sub Server1()
'
' Hide Macro
'
Dim var1 As Long
Dim var2 As Long
var1 = Worksheets("RowInfo").Cells(4, "B").Value
var2 = Worksheets("RowInfo").Cells(4, "C").Value
'
Range(var1 & ":" & var2).EntireRow.Hidden = True
'
End Sub
Any Help would be great, when I run the above I get
"Method 'Range' of object'_Global' Failed
I have also tried Rows as well with no luck