PC Review


Reply
Thread Tools Rate Thread

copying an array formula

 
 
Matt S
Guest
Posts: n/a
 
      7th Jan 2010
All,

I tried this code which contains my array formula:

ActiveCell.Range("A1:A3").Copy
Destination:=ActiveCell.Range("A1:J3,L1:O3,Q1:S3")

Thinking it would copy the Formula Array but on execution, VBA promptly went
to End Sub and stopped. So then I tried this:

ActiveCell.Offset(3, 0).Range("A1:J1,L1:O1,Q1:S1").FormulaArray =
"=MIN(IF((R13C:R" & LastRow & "C)>0,R13C:R" & LastRow & "C))"

It copies the formula over... but it retains the same column as the first
cell for the range. It also only pastes into A1:J1 and ignores the rest.
Please help! How do I copy this formula array in
multiple cells?

Thanks so much,
Matt

 
Reply With Quote
 
 
 
 
Barb Reinhardt
Guest
Posts: n/a
 
      7th Jan 2010
It's not working because you've got syntax errors in your code. I'm not
sure if this will do what you want, but try it.

ActiveSheet.Range("A1:A3").Copy _
Destination:=ActiveSheet.Range("A1:J3,L1:O3,Q1:S3")

--
HTH,

Barb Reinhardt



"Matt S" wrote:

> All,
>
> I tried this code which contains my array formula:
>
> ActiveCell.Range("A1:A3").Copy
> Destination:=ActiveCell.Range("A1:J3,L1:O3,Q1:S3")
>
> Thinking it would copy the Formula Array but on execution, VBA promptly went
> to End Sub and stopped. So then I tried this:
>
> ActiveCell.Offset(3, 0).Range("A1:J1,L1:O1,Q1:S1").FormulaArray =
> "=MIN(IF((R13C:R" & LastRow & "C)>0,R13C:R" & LastRow & "C))"
>
> It copies the formula over... but it retains the same column as the first
> cell for the range. It also only pastes into A1:J1 and ignores the rest.
> Please help! How do I copy this formula array in
> multiple cells?
>
> Thanks so much,
> Matt
>

 
Reply With Quote
 
Matt S
Guest
Posts: n/a
 
      7th Jan 2010
Barb,

This is my code, following your suggestion:

ActiveCell.Offset(3, 0).FormulaArray = "=MIN(IF((R13C:R" & LastRow &
"C)>0,R13C:R" & LastRow & "C))"
ActiveCell.Range("A1:A3").Copy
Destination:=ActiveCell.Range("A1:J3,L1:O3,Q1:S3")

It evaluates the Formula Array but then when it tries to copy, instead it
skips the rest of my code and goes straight to "End Sub". What is causing
that?

Thanks,
Matt

"Barb Reinhardt" wrote:

> It's not working because you've got syntax errors in your code. I'm not
> sure if this will do what you want, but try it.
>
> ActiveSheet.Range("A1:A3").Copy _
> Destination:=ActiveSheet.Range("A1:J3,L1:O3,Q1:S3")
>
> --
> HTH,
>
> Barb Reinhardt
>
>
>
> "Matt S" wrote:
>
> > All,
> >
> > I tried this code which contains my array formula:
> >
> > ActiveCell.Range("A1:A3").Copy
> > Destination:=ActiveCell.Range("A1:J3,L1:O3,Q1:S3")
> >
> > Thinking it would copy the Formula Array but on execution, VBA promptly went
> > to End Sub and stopped. So then I tried this:
> >
> > ActiveCell.Offset(3, 0).Range("A1:J1,L1:O1,Q1:S1").FormulaArray =
> > "=MIN(IF((R13C:R" & LastRow & "C)>0,R13C:R" & LastRow & "C))"
> >
> > It copies the formula over... but it retains the same column as the first
> > cell for the range. It also only pastes into A1:J1 and ignores the rest.
> > Please help! How do I copy this formula array in
> > multiple cells?
> >
> > Thanks so much,
> > Matt
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying an Array formula Vance K Microsoft Excel Crashes 3 12th Nov 2009 11:08 PM
Re: Copying an Array Formula BenjieLop Microsoft Excel Misc 0 15th Jul 2005 07:30 PM
Copying an Array Formula montagu Microsoft Excel Misc 0 15th Jul 2005 07:16 PM
Copying array formula to a range of cells... =?Utf-8?B?RGVubmlzIEcu?= Microsoft Excel Programming 7 4th Jan 2005 09:43 PM
Copying an array formula... =?Utf-8?B?RGVubmlzIEcu?= Microsoft Excel Worksheet Functions 12 3rd Jan 2005 02:49 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:40 AM.