'Speed up my macro to copy paste up to 900 cells in excel
I have a tool that displays and stores data submitted by different people. the way the file is setup is using a pivot to show budget and forecast, and then I have a column for users to submit an outlook. What I do normally is set this file to be equal to forecast by copy pasting, if there is no data submitted. However, because the column where the data is inputted is part of the pivot table, I can not copy paste so I created a macro that essentially goes row by row and sets Outlook = to forecast (cell M28 = Q28, for example). This works ok but for one set of data with 390 rows, it takes 3:30mins to run. is there a way to optimize this or another way to copy paste data into a column that is part of a pivot? The VBA code for the macro is (first it selects the region for which I want to see and submit data):
ActiveWorkbook.SlicerCaches("Slicer_Region2").VisibleSlicerItemsList = Array( _
"[BaseData].[Region].&[Asia]")
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=RC[4] "
Range("m28").Select
It is the same code repeating from cell M28 thru M390. I need to do this for 5 more regions, and the one with most data is 700 rows.
Any help is much appreciated.
THanks!
Solution 1:[1]
If I am not misunderstanding, maybe you can not select any cell.
Try something like: Range("F28").Formula... and so.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Community |
