LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 193
Default how to use VBA variable in formula?

I sincerely appreciate whoever's help on this question!

I need to use Excel formula functions of COUNTIF and SUM in VBA. The range
for calculation need to refer to a variable set in the VBA which is changing
from one worksheet to another. However, the variable can't be recognized by
the COUNTIF function. The actual statement is:
Selection.Value = "=COUNTIF(RC[1 - C]:RC[- 1], ""Abs"")"
or
Activecell.FormulaR1C1 = "=COUNTIF(RC[1 - C]:RC[- 1], ""Abs"")"
"C" is the variable set in VBA that has to be used for iteration steps in
diferrent worksheet.
How to make Excel function work by using the variable "C"?

 
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
Variable VBA Max Formula Gizmo Excel Discussion (Misc queries) 2 June 6th 08 06:12 AM
formula containing a formula-dependent variable - how? CompeterN New Users to Excel 1 November 8th 06 02:02 PM
Variable in formula StephanieH Excel Programming 2 January 12th 06 03:10 PM
Using a variable in a VBA formula Colin Vicary Excel Discussion (Misc queries) 3 November 8th 05 11:39 AM
Using a variable in a formula Noah Excel Programming 3 October 28th 05 04:39 PM


All times are GMT +1. The time now is 12:17 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"