I want to count the number of rows in a worksheet, use the rowcount to define a global variable then use that row count to define a range to autofill the identified number of cells.
What I have that does not work is:
'This section declares variables for later use
Dim MillenniumLastCell
Dim MillenniumLastFormulaA
Dim MillenniumLastFormulaB
Dim MillenniumLastFormulaC
'
' This is the code for calculating the value of the variables
MillenniumLastCell = (Application.CountA(Range("A:A")) - 1)
MillenniumLastFormulaA = "A2:A" & MillenniumLastCell
MillenniumLastFormulaA = "B2:B" & MillenniumLastCell
MillenniumLastFormulaA = "C2:C" & MillenniumLastCell
'
'formulas get defined here and populate cells A2:C2
'
'This is the code to autofill the desired number of cells in colmun a with the formula in A2
Range("A2").Select
Selection.AutoFill Destination:=Range(MillenniumLastFormulaA)
Range(MillenniumLastFormulaA).Select
What the heck am I doing wrong?
Bookmarks