Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Problem with formulae in VBA

Thanks Bob

"John" wrote:

Hi,

I've Recorded Excel placing a formula in a cell and amended it to pick up a
sheetname reference in the formula.

In XL, the formula is
=COUNTA('211106'!$A:$A)-1
When i record the formula i get
ActiveCell.FormulaR1C1 = "=COUNTA('211106'!C1)-1"
I changed the hardcode 221106 to be a reference to a variable called MySheet,
therefore the formula in VBA now reads:
ActiveCell.FormulaR1C1 = "=COUNTA("" ' " & MySheet & " '!C1)-1"""
When i step through this i get the error:
Runtime error 1004 Application-defined or object-defined error
If it was a mistake with the Syntax then before i could run it i would get
the error, so somewhat naively i would assume the problem is with the
concatenation.

Appreciate if anyone has a solution to this please.

Thanks

John

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
I have a problem with a formulae. James Excel Discussion (Misc queries) 2 November 24th 08 10:45 PM
Formulae: Paste value formulae after doing an average operation Lim Excel Discussion (Misc queries) 4 April 20th 08 07:31 PM
Array formulae - problem Ola2B Excel Discussion (Misc queries) 4 June 21st 07 01:09 PM
Help with Formulae please! Puzzled Excel Discussion (Misc queries) 5 April 1st 06 12:27 PM
Searching TEXT in formulae, rather than results of formulae AndyE Excel Worksheet Functions 1 July 15th 05 10:57 AM


All times are GMT +1. The time now is 10:21 PM.

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"