View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas[_2_] Gary Keramidas[_2_] is offline
external usenet poster
 
Posts: 364
Default HELP with inserting formula

give this a try

Option Explicit
Dim lastrow As Long
Dim ws As Worksheet
Sub addformula()
lastrow = Cells(Rows.Count, "B").End(xlUp).Row

For Each ws In Worksheets
ws.Range("A4").Formula = "=counta($B$7:B" & lastrow & ")"
Next ws
End Sub

--


Gary


"Dragos" wrote in message
...
Hi Everyone,

I would like a Macro that Inserts the Following Formula into all of my
Excel
Sheet in the Cell "A4" Please.
The formula would be: A4 = COUNTA($B$7:last active row).
I want to mention that the last row varies.
I looked at the other discussion, but I didn't quite understand.
Thank you in advance,

Dragos

--
Dragos