Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 13
Default Programmatically add a Formula in a worksheet?

Hi,

My workbook has 2 worksheets: WSA & WSB. WSB gives stats on numbers
shown in WSA. In WSB, in cell B2, there is a function that counts
elements from WSA:

=COUNTIF('WSA'!D2:D35000,"<N/A")

Still in WSB, using a commandButton, I'd like to modify the above
formula programmatically. I've been trying using:


ActiveWorkbook.Sheets("WSB").Cells(1, 2).Formula = "=COUNTIF('WSA'!
D2:D36000,"<N/A")'

but no luck. However, if I put something simple that such
as: .Formula = "=sum(D3:D10)", it works. So I suspect the worksheet
referencing is in cause here.

Thanks for your help
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Programmatically add a Formula in a worksheet?

Hi,

The problem is the quotes, note how i've doubled the internal quotes up
around the NA

ActiveWorkbook.Sheets("WSB").Cells(1, 2).Formula =
"=COUNTIF('WSA'!D2:D36000,""<N/A"")"

Mike

"circuit_breaker" wrote:

Hi,

My workbook has 2 worksheets: WSA & WSB. WSB gives stats on numbers
shown in WSA. In WSB, in cell B2, there is a function that counts
elements from WSA:

=COUNTIF('WSA'!D2:D35000,"<N/A")

Still in WSB, using a commandButton, I'd like to modify the above
formula programmatically. I've been trying using:


ActiveWorkbook.Sheets("WSB").Cells(1, 2).Formula = "=COUNTIF('WSA'!
D2:D36000,"<N/A")'

but no luck. However, if I put something simple that such
as: .Formula = "=sum(D3:D10)", it works. So I suspect the worksheet
referencing is in cause here.

Thanks for your help

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 13
Default Programmatically add a Formula in a worksheet?

That simple! It works, thanks very much.
On Jul 6, 9:17*am, circuit_breaker wrote:
Hi,

My workbook has 2 worksheets: WSA & WSB. *WSB gives stats on numbers
shown in WSA. *In WSB, in cell B2, there is a function that counts
elements from WSA:

=COUNTIF('WSA'!D2:D35000,"<N/A")

Still in WSB, using a commandButton, I'd like to modify the above
formula programmatically. *I've been trying using:

ActiveWorkbook.Sheets("WSB").Cells(1, 2).Formula = "=COUNTIF('WSA'!
D2:D36000,"<N/A")'

but no luck. *However, if I put something simple that such
as: *.Formula = "=sum(D3:D10)", *it works. *So I suspect the worksheet
referencing is in cause here.

Thanks for your help


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
help creating new hyperlinks programmatically J Links and Linking in Excel 1 January 14th 08 08:15 AM
Querying Properties programmatically BizMark Excel Discussion (Misc queries) 0 June 19th 06 04:17 PM
OWC load add-ins programmatically in dotnet? ESmith Excel Discussion (Misc queries) 0 September 16th 05 07:36 PM
How to add an image to a worksheet programmatically mjohnson Excel Discussion (Misc queries) 2 March 16th 05 04:48 PM
Deleting rows programmatically David Bateman Excel Worksheet Functions 1 March 6th 05 02:10 AM


All times are GMT +1. The time now is 05:48 PM.

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

About Us

"It's about Microsoft Excel"