Glaswegian
05-24-2012, 06:58 AM
Hi
I'm having another bad day...
I'm trying to insert a CountA formula in code as part of a routine that pastes data to a sheet, filters the data, and renames the sheet, and so on.
For some reason I cannot find the correct syntax to have the formula inserted correctly. Code snippet below
With ActiveWorkbook
Nrow = .ActiveSheet.Cells(Rows.Count, 7).End(xlUp).Row
.ActiveSheet.Cells(Nrow + 2, 7).Formula = "=CountA(G2:G" & Nrow")"
.ActiveSheet.Cells(Nrow + 2, 7).Font.Bold = True
End With
I need to have a CountA formula in a cell 2 rows below the end of the data and in column G.
I know this is something silly but it's just not happening today. Thanks.
I'm having another bad day...
I'm trying to insert a CountA formula in code as part of a routine that pastes data to a sheet, filters the data, and renames the sheet, and so on.
For some reason I cannot find the correct syntax to have the formula inserted correctly. Code snippet below
With ActiveWorkbook
Nrow = .ActiveSheet.Cells(Rows.Count, 7).End(xlUp).Row
.ActiveSheet.Cells(Nrow + 2, 7).Formula = "=CountA(G2:G" & Nrow")"
.ActiveSheet.Cells(Nrow + 2, 7).Font.Bold = True
End With
I need to have a CountA formula in a cell 2 rows below the end of the data and in column G.
I know this is something silly but it's just not happening today. Thanks.