VBA Syntax for using a variable in a worksheet function

  • Thread starter Thread starter xjetjockey
  • Start date Start date
X

xjetjockey

Can someone help with a basic question?

This is the function which works in Excel:

=COUNTA(A337:A359)

I don't want to put it on the worksheet, but rather calculate it in my
VBA procedure.

I have two variables that identify the row numbers as follows: FFR =
row 337, and FTR = row 359.

I want the result of the above formula assigned to variable DayNum.

Any help would be greatly appreciated.

Thanks.

Robert
 
Perfect. Thank you so much.
Try:

Sub Test()
Dim FFR As Long
Dim FRT As Long
Dim DayNum As Double

FFR = 337
FTR = 359

DayNum = Application.CountA(Range("A" & _
FFR & ":" & "A" & FTR))

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top