Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default VBA Syntax for using a variable in a worksheet function

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

  #2   Report Post  
Posted to microsoft.public.excel.misc
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default VBA Syntax for using a variable in a worksheet function

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



"xjetjockey" wrote:

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


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default VBA Syntax for using a variable in a worksheet function

Perfect. Thank you so much.

JMB wrote:
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



"xjetjockey" wrote:

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



  #4   Report Post  
Posted to microsoft.public.excel.misc
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default VBA Syntax for using a variable in a worksheet function

Glad to help.

"xjetjockey" wrote:

Perfect. Thank you so much.

JMB wrote:
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



"xjetjockey" wrote:

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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
numerical integration integreat Excel Discussion (Misc queries) 4 May 12th 06 02:40 AM
Aling multiple sets of data by header column MarkusO Excel Discussion (Misc queries) 2 April 12th 06 07:29 PM
Offset function referencing worksheet Jeff Excel Discussion (Misc queries) 1 September 11th 05 07:01 PM
Worksheet VBA function - not recognized G Lykos Excel Worksheet Functions 4 August 23rd 05 05:50 AM
changing font style in a complex worksheet function gvm Excel Worksheet Functions 6 August 3rd 05 01:29 AM


All times are GMT +1. The time now is 06:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"