ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   CountA formila for a varying range (https://www.excelbanter.com/excel-programming/413890-counta-formila-varying-range.html)

Simon[_2_]

CountA formila for a varying range
 
Sub Count()

Dim Work As Workbook
Dim Figures As Workbook

Set Work = Workbooks.Open("N:Work.csv")
Set Figures = Workbooks.Open("N:\Figures June.xls")

Work.Activate
Range("A1").Select
RngA = Range(Selection, Selection.End(xlDown)).Select
Figures.Activate

ActiveCell.FormulaR1C1 = "=COUNTA(DALWork!R1C1:RngA)"
'ActiveRange = "=COUNTA(Selection)"

'RngA states True

End Sub

What should I put in the formula instead of RngA?

Bob Phillips

CountA formila for a varying range
 
How about

ActiveCell.Formula = "=COUNTA(" & RngA.Address(,,,True) & ")"


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Simon" wrote in message
...
Sub Count()

Dim Work As Workbook
Dim Figures As Workbook

Set Work = Workbooks.Open("N:Work.csv")
Set Figures = Workbooks.Open("N:\Figures June.xls")

Work.Activate
Range("A1").Select
RngA = Range(Selection, Selection.End(xlDown)).Select
Figures.Activate

ActiveCell.FormulaR1C1 = "=COUNTA(DALWork!R1C1:RngA)"
'ActiveRange = "=COUNTA(Selection)"

'RngA states True

End Sub

What should I put in the formula instead of RngA?





All times are GMT +1. The time now is 02:40 PM.

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