Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Array Formula in VBA

I have been using a array formula like this to 'count' the number of cells
that =1 in one column and 25 in the second column. The file the cell is
checking is in another file.
{=SUM(('[file2.xls]Sheet3'!$H$2:$H$1800=1)*('[fiel2.xls]Sheet3'!$N$2:$N$180050))}

Currently when the file opens it asks if I want to update and then it checks
file2 and enters the data. Simple enough. But now I am writing code to work
at the press of a macro button, and I am not making progress.

Workbooks("file1.xls").Sheets("Sheet1").Activate
Range("B6").FormulaArray =
{=SUM(('[file2.xls]Sheet3'!$H$2:$H$1800=1)*('[file2.xls]Sheet3!$N$2:$N$180050))}

Any guidance is appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Array Formula in VBA

Perhaps setting Application.DisplayAlerts to False before running your code
and back to True afterwards will handle your problem. If it works for this
situation, setting DisplayAlerts to False will mean any dialog boxes that
would be have been displayed will not display and the default button will be
selected automatically (well, for your case... this works the opposite for
SaveAs).

Rick


"Bigfoot17" wrote in message
...
I have been using a array formula like this to 'count' the number of cells
that =1 in one column and 25 in the second column. The file the cell is
checking is in another file.
{=SUM(('[file2.xls]Sheet3'!$H$2:$H$1800=1)*('[fiel2.xls]Sheet3'!$N$2:$N$180050))}

Currently when the file opens it asks if I want to update and then it
checks
file2 and enters the data. Simple enough. But now I am writing code to
work
at the press of a macro button, and I am not making progress.

Workbooks("file1.xls").Sheets("Sheet1").Activate
Range("B6").FormulaArray =
{=SUM(('[file2.xls]Sheet3'!$H$2:$H$1800=1)*('[file2.xls]Sheet3!$N$2:$N$180050))}

Any guidance is appreciated.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Array Formula in VBA

I am afraid I was not clear so I will take another stab at it.

I currently have a array formula in file1.xls on sheet1 in cell B6
={=SUM(('[file2.xls]Sheet3'!$H$2:$H$1800=1)*('[file2.xls]Sheet3'!$N$2:$N$180050))}

This works fine, but now I need to get the same data into the same cell
(from file2) with VBA and cannot get the proper syntax.
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Array Formula in VBA

Try this one. Assuming file1.xls and file2.xls are in the same folder.

Range("B6").FormulaArray =
"=SUM(([file2.xls]Sheet3!$H$2:$H$1800=1)*([file2.xls]Sheet3!$N$2:$N$180050))"

keiji

"Bigfoot17" wrote in message
...
I am afraid I was not clear so I will take another stab at it.

I currently have a array formula in file1.xls on sheet1 in cell B6:
={=SUM(('[file2.xls]Sheet3'!$H$2:$H$1800=1)*('[file2.xls]Sheet3'!$N$2:$N$180050))}

This works fine, but now I need to get the same data into the same cell
(from file2) with VBA and cannot get the proper syntax.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Array Formula in VBA

Give this person a donut! Thanks it got me where i needed to be. My final
line was:
Range("B6").FormulaArray =
"=SUM(('[file2.xls]Sheet3'!$H$2:$H$1800=1)*('[file2.xls]sheet3'!$K$2:$K$180025))"
I wasn't far off in figuring it out in my first post, but I was missing a
single quote and threw everything off. Thanks.

"kounoike" wrote:

Try this one. Assuming file1.xls and file2.xls are in the same folder.

Range("B6").FormulaArray =
"=SUM(([file2.xls]Sheet3!$H$2:$H$1800=1)*([file2.xls]Sheet3!$N$2:$N$180050))"

keiji

"Bigfoot17" wrote in message
...
I am afraid I was not clear so I will take another stab at it.

I currently have a array formula in file1.xls on sheet1 in cell B6:
={=SUM(('[file2.xls]Sheet3'!$H$2:$H$1800=1)*('[file2.xls]Sheet3'!$N$2:$N$180050))}

This works fine, but now I need to get the same data into the same cell
(from file2) with VBA and cannot get the proper syntax.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Array Formula in VBA

you're welcome. in this case i think it would work without single quote, but
adding single quote is better way.

keiji

"Bigfoot17" wrote in message
...
Give this person a donut! Thanks it got me where i needed to be. My final
line was:
Range("B6").FormulaArray =
"=SUM(('[file2.xls]Sheet3'!$H$2:$H$1800=1)*('[file2.xls]sheet3'!$K$2:$K$180025))"
I wasn't far off in figuring it out in my first post, but I was missing a
single quote and threw everything off. Thanks.

"kounoike" wrote:

Try this one. Assuming file1.xls and file2.xls are in the same folder.

Range("B6").FormulaArray =
"=SUM(([file2.xls]Sheet3!$H$2:$H$1800=1)*([file2.xls]Sheet3!$N$2:$N$180050))"

keiji

"Bigfoot17" wrote in message
...
I am afraid I was not clear so I will take another stab at it.

I currently have a array formula in file1.xls on sheet1 in cell B6:
={=SUM(('[file2.xls]Sheet3'!$H$2:$H$1800=1)*('[file2.xls]Sheet3'!$N$2:$N$180050))}

This works fine, but now I need to get the same data into the same cell
(from file2) with VBA and cannot get the proper syntax.




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
Array formula SUMIF with 2D sum_range array Rich_84 Excel Worksheet Functions 3 April 3rd 09 10:46 PM
Array formula: how to join 2 ranges together to form one array? Rich_84 Excel Worksheet Functions 2 April 1st 09 06:38 PM
Find specific value in array of array formula DzednConfsd Excel Worksheet Functions 2 January 13th 09 06:19 AM
copy one array formula to an array range guedj54 Excel Programming 2 October 29th 06 07:38 PM
Tricky array formula issue - Using array formula on one cell, then autofilling down a range aspenbordr Excel Programming 0 July 27th 05 03:59 PM


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