Record Macro to Copy & Paste as Values - paste into cells that might move up/down as rows above are added/deleted

momentumons

Board Regular
Joined
Mar 30, 2020
Messages
57
Office Version
  1. 2016
Platform
  1. Windows
Hello! Can you help?

This should be simple, right?

I have two cells (eg. AC58 & AC59) with a % number in each. I need to copy & paste these numbers into the cells next to them (AD58 & AD59) - this is so I can re-use these numbers without creating a circular reference.

When I do a simple 'record macro' of copy & paste-as-values this works UNTIL I add/delete rows above... then it always copies and pastes the exact same cells instead of moving with the spreadsheet. How can I copy/paste these numbers when they move up/down.

Does that make sense? Thanks
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
VBA Code:
Sub REFRESH()
'
' REFRESH Macro
'

'
    Range("AD58").Select
    Selection.ClearContents
    Range("AD59").Select
    Selection.ClearContents
    Range("AC58:AC59").Select
    Selection.Copy
    Range("AD58:AD59").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
End Sub
 
Upvote 0
If anyone finds this thread - I found a solution by using Named Ranges :)
 
Upvote 0

Forum statistics

Threads
1,214,907
Messages
6,122,181
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top