LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Automating copy/paste/paste special when row references change

I am a rookie with macros and even more of a rookie with VBA. I have
reviewed Excel's help file and posts in this and other groups via Google and
have not found anything directly on this point.

I am using Excel 2007.

I need to copy formulas from a row to the next row down and then overwrite
the formulas in the source row with the values themselves. Each row
represents numerical values for the end of each week. The formulas grab the
number from elsewhere in the same file.

I have used the macro recorder and it shows this code in the edit box. I
haven't made any manual edits.


Sub Macro2test()
'
' Macro2test Macro
' yada yada
'
' Keyboard Shortcut: Ctrl+f
'
Range("B260:W260").Select
Range("W260").Activate
Selection.Copy
Range("B261").Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Range("B260").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
End Sub





In this case, formulas representing the weekly values are in B260 through
W260. I need to grab the formulas and paste them to B261 through W261, and
then overwrite B260 through W260 with the values per se (not the formulas).

It works as far as it goes, but doesn't allow for the fact that I am
marching down another row every week. A month from today, I will be
operating down around row 264 and the macro as written above is locked into
rows 260 and 261.

Is there any way to force the row references in the macro to increment
weekly, or to simply force the formula paste to the next row down and the
value paste special back to the source row, regardless of row number?




 
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
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
Copy; Paste; Paste Special are disabled Mack Neff[_3_] Excel Discussion (Misc queries) 0 April 28th 08 06:29 PM
Conditional formatting -- copy paste special won't change referenc Ed in Biotech Excel Discussion (Misc queries) 3 July 20th 06 06:54 PM
help w/ generic copy & paste/paste special routine DavidH[_2_] Excel Programming 5 January 23rd 06 03:58 AM
Dynamic Copy/Paste Special Formulas/Paste Special Values Sharon Perez Excel Programming 3 August 7th 04 09:49 PM


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