How do I get a cell value to be uses within a macro
hi
try something like this, using variables.....
Dim r As Range
Dim v As Long
Set r = Range("Z1")
v = r.Value
Rows("2:" & v).Hidden = True
works in 2003, should work in 2007. (hope, hope)
regards
FSt1
"Mac0001UK" wrote:
I am using Excel 2007.
I have macro designed to hide rows which reads:-
Range("A2").Select
Rows("2:1311").Select
Selection.EntireRow.Hidden = True
Range("A2"). Select
This, as expected, hides row 2 to 1311.
I want to replace 1311 with a variable value read from a cell, Z1.
How do I get that cell value to be read in the macro.
I have tried:-
Range("A2").Select
Rows("2:=CELL("CONTENTS",Z1")
Range("A2").Select
but this does not work.
I obviously have a syntax problem, can anyone help please.
--
Mac Macdonald
|