PC Review


Reply
Thread Tools Rate Thread

Copy and Paste Formula from ActiveCell to cells in 13 columns priorto the active column

 
 
sgltaylor
Guest
Posts: n/a
 
      30th Nov 2009
Hi All,

I have a sum formula in cell Z30. I am trying to figure out how to
copy the sum formula and paste it into the 13 columns immediately
before column Z. The trick is that I will not always be starting from
column Z and not always on the same row either. At times, it may be
column AA10 or AD50 etc so the code need to be able handle this.

Any ideas?

Thanks,

Steve
 
Reply With Quote
 
 
 
 
Gary''s Student
Guest
Posts: n/a
 
      30th Nov 2009
Sub CopyFormula()
Set r1 = ActiveCell
rr = r1.Row
rc = r1.Column
Set r2 = Range(Cells(rr, rc - 1), Cells(rr, rc - 13))
r1.Copy r2
End Sub

This will copy the active celll to the 13 cells immediate adjacent to the
left. There is a shorter method using Offset().
--
Gary''s Student - gsnu200909


"sgltaylor" wrote:

> Hi All,
>
> I have a sum formula in cell Z30. I am trying to figure out how to
> copy the sum formula and paste it into the 13 columns immediately
> before column Z. The trick is that I will not always be starting from
> column Z and not always on the same row either. At times, it may be
> column AA10 or AD50 etc so the code need to be able handle this.
>
> Any ideas?
>
> Thanks,
>
> Steve
> .
>

 
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
Copy Multiple Columns, Paste Under a Single column =?Utf-8?B?U3JpcmFt?= Microsoft Excel Worksheet Functions 11 17th May 2007 04:14 AM
How I can copy / paste a selected cells to other columns in Excel =?Utf-8?B?TS5SYWZhdA==?= Microsoft Excel Misc 4 7th Nov 2006 05:42 AM
Copy/Paste how to avoid the copy of formula cells w/o calc values =?Utf-8?B?RGVubmlz?= Microsoft Excel Misc 10 2nd Mar 2006 10:47 PM
Paste Cells in Column A to Columns B-K George Plakas Microsoft Excel Programming 11 31st Oct 2003 04:47 AM
Paste Cells in Column A to Columns B-K George Plakas Microsoft Excel Misc 2 31st Oct 2003 01:09 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:12 AM.