MACRO copy/paste does not work.

FrankieG

New Member
Joined
Jun 13, 2021
Messages
14
Office Version
  1. 365
Platform
  1. Windows
Hello friends!

I would like to use a (fairly simple) macro to copy paste scenario outcomes. Values only.

As context: I have 2 drop-down buttons for scenarios, and with every change the scenario outcomes (an array of cells) changes. I would like to copy-paste these into a summary page.

I have tried to record the macro myself, but the problem is that it ONLY records the LAST known scenario. And copy-pastes this for all options.
Below an example line of macro code. Scenario is selected in cell L11 (e.g. "High" or "Base"). Copy Paste ranges would be e.g. S155:BP165, or S131:BP151.
The copy-paste location ranges work, but it only replicates the last known scenario (e.g. "High" across all cases)

Any tips? A swift response would be much appreciated! best wishes


Sub Macro15()
'
' Macro15 Macro
'

'
Range("L11").Select
ActiveWindow.SmallScroll Down:=-28
Range("S131:BP151").Select
Selection.Copy
ActiveWindow.SmallScroll Down:=21
Range("S155:BP165").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("L11").Select
ActiveWindow.SmallScroll Down:=-21
Range("S131:BP151").Select
Application.CutCopyMode = False
Selection.Copy
ActiveWindow.SmallScroll Down:=28
Range("S179").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Thanks very much for the answer. I just did, but this does not solve the issue. In fact, the values are already pasted exactly where they need to be pasted (and transpose only changes this). So this is all good.

It is the actual values/outputs that are wrong: they always reflect the latest selected scenario (in L11 in the example). Whereas the copy/paste should be a variety of different scenarios (e.g. Low/Base/High), pasted throughout the summary sheet (e.g. S131:BP 151, S155:BP 165 etc.)

Cheers
Frank
 
Upvote 0

Forum statistics

Threads
1,215,743
Messages
6,126,605
Members
449,321
Latest member
syzer

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