P
Patti
Good morning,
I have 2 questions:
1.) I need to copy several formulas from different columns in row 2 to a
variable number of rows. For the first one, I use:
a = Range("A65536").End(xlUp).Row
Set SourceRange = Worksheets("Team").Range("e2")
Set fillRange = Worksheets("Team").Range("e2:e" & a)
SourceRange.AutoFill Destination:=fillRange
The question is, if I want reuse this same code multiple times, do I
just use "Set a = Nothing" after each use?
Is "a" dimmed as a Range?
2.) The other, more pressing question, is: How do I set a variable equal to
the result of a formula used on an unknown number of rows? For example, if
the code above is a countif formula, how do I then say "sum this unknown
range of cells then set mySum equal to it"? So somewhere else in my
workbook I can code "There are " & mySum & " records meeting this criteria".
I hope that's clear. Thanks in advance!
Patti
I have 2 questions:
1.) I need to copy several formulas from different columns in row 2 to a
variable number of rows. For the first one, I use:
a = Range("A65536").End(xlUp).Row
Set SourceRange = Worksheets("Team").Range("e2")
Set fillRange = Worksheets("Team").Range("e2:e" & a)
SourceRange.AutoFill Destination:=fillRange
The question is, if I want reuse this same code multiple times, do I
just use "Set a = Nothing" after each use?
Is "a" dimmed as a Range?
2.) The other, more pressing question, is: How do I set a variable equal to
the result of a formula used on an unknown number of rows? For example, if
the code above is a countif formula, how do I then say "sum this unknown
range of cells then set mySum equal to it"? So somewhere else in my
workbook I can code "There are " & mySum & " records meeting this criteria".
I hope that's clear. Thanks in advance!
Patti