Hi All,
I have a VBA Macro that does the job but I am trying to improve it and I am not able to figure it out, I would really appreciate your help.
To update my ActiveWorkbook I open another Workbook from a hyperlink and need to copy a list of ranges. Currently I am simply repeating the code to Activate one workbook, select the range, copy, activate the ActiveWorkbook and then select the target range and paste. Since I have a lot of ranges I need to copy this is a very tedious job and my Macro is very long. I hope there is a way to just loop through the ranges and perhaps even set value=value instead of copy pasting as this might make it faster?
For example, I need to copy
Sheets("Jan").Range("B4") to the ActiveWorkbook Sheets("Jan").Range("C4"), then
Sheets("Jan").Range("F2:G4") to the ActiveWorkbook Sheets("Jan").Range("G2:H4"), then
I need to copy Sheets("Feb").Range("B4") to the ActiveWorkbook Sheets("Feb").Range("C4"), then
Sheets("Feb").Range("F2:G4") to the ActiveWorkbook Sheets("Feb").Range("G2:H4"), etc
This goes on for all 12 months and some other sheets as well that I need to copy data from. Is there a way I can simply have a list of all the sheets and ranges that need to be copied and where they need to be pasted? And then the Macro loops through those?
Thank you!
I have a VBA Macro that does the job but I am trying to improve it and I am not able to figure it out, I would really appreciate your help.
To update my ActiveWorkbook I open another Workbook from a hyperlink and need to copy a list of ranges. Currently I am simply repeating the code to Activate one workbook, select the range, copy, activate the ActiveWorkbook and then select the target range and paste. Since I have a lot of ranges I need to copy this is a very tedious job and my Macro is very long. I hope there is a way to just loop through the ranges and perhaps even set value=value instead of copy pasting as this might make it faster?
For example, I need to copy
Sheets("Jan").Range("B4") to the ActiveWorkbook Sheets("Jan").Range("C4"), then
Sheets("Jan").Range("F2:G4") to the ActiveWorkbook Sheets("Jan").Range("G2:H4"), then
I need to copy Sheets("Feb").Range("B4") to the ActiveWorkbook Sheets("Feb").Range("C4"), then
Sheets("Feb").Range("F2:G4") to the ActiveWorkbook Sheets("Feb").Range("G2:H4"), etc
This goes on for all 12 months and some other sheets as well that I need to copy data from. Is there a way I can simply have a list of all the sheets and ranges that need to be copied and where they need to be pasted? And then the Macro loops through those?
Thank you!