Dynamic cells referencing

  • Thread starter Thread starter Thinh
  • Start date Start date
T

Thinh

I have code in VBA with variables.

I want to put an excel count forumla into a cell in the spreadsheet
referencing to the variables i have created in VBA.

ie. Dymanic cell refencing

How to make this work?

-------------------------------------------------------------------------------
eg: VBA Code

integer = 1
integer2 = 2

ActiveCell.FormulaR1C1 = "count(integer:integer2)"
 
thinh,

there are two ways.

declare integer

COUNT("A" & integer1 : "A" & integer2)

or

declare string

COUNT("A" + Trim(Str(number1)) : "A" + Trim(Str(number2))

try these.

mac.
 
maybe i misinterpreted your question.

if you are putting a formula in a cell thru code, you might want to do
this - "=COUNT(A:A)".

mac.
 
Back
Top