Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Copy and Paste Formula from ActiveCell to cells in 13 columns priorto the active column

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Copy and Paste Formula from ActiveCell to cells in 13 columns prio

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
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
Copy Multiple Columns, Paste Under a Single column Sriram Excel Worksheet Functions 12 April 4th 23 11:37 AM
Bug - Programmatic copy/paste other sheet to activecell Greg Wilson Excel Programming 4 April 13th 07 06:34 AM
How I can copy / paste a selected cells to other columns in Excel M.Rafat Excel Discussion (Misc queries) 4 November 7th 06 05:42 AM
How do I set up a copy and paste formula with ascending columns Ken Proj mgr New Users to Excel 4 February 27th 06 03:18 PM
Paste Cells in Column A to Columns B-K George Plakas Excel Programming 11 October 31st 03 04:47 AM


All times are GMT +1. The time now is 09:20 AM.

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"