VBA copy and paste rows and columns based on variable

jocker_boy

Board Regular
Joined
Feb 5, 2015
Messages
83
Hello,
If i have this table:

M1M2Total
Title1Description
Xaaaaxxxxxxxxxx
Xaaaaxxxxxxxxxx
Xaaaxxxxxxxxxx
Title1
Xbbbxxxxxxxxxx
Xbbbxxxxxxxxxx
Xbbbxxxxxxxxxx

I would like to copy rows "x" times and also copy columns "y" times.

My goal is to ask to user:
  • What is the first sheet: "Sheet3"
    • Will Replace "Title1" with "Sheet3" name
  • How many repetitions is necessary: "x=3"
    • Will copy rows 3-6 and paste in rows belows. Number of times: x-1-> Rows 3-6 are fixed
    • Will copy rows 8-11 and past in rows belows. Number of times: x-1 ->Rows 8-11 are fixed
  • How many months: "y=4"
    • Will copy column 4 and paste in columns. Number of times: y-2 ->Column 4 is fixed
  • Insert "Sheet4" name and Insert "Sheet5" name.

M1M2M3M4Total
"Sheet3"Description
Xaaaaxxxxxxxxxxxxxxxx
Xaaaaxxxxxxxxxxxxxxxx
Xaaaxxxxxxxxxxxxxxxx
"Sheet4"Description
Xaaaaxxxxxxxxxxxx
Xaaaaxxxxxxxxxxxx
Xaaaxxxxxxxxxxxx
"Sheet5"Description
Xaaaaxxxxxxxxxxxxxxxx
Xaaaaxxxxxxxxxxxxxxxx
Xaaaxxxxxxxxxxxxxxxx
"Sheet3"Description
Xbbbxxxxxxxxxxxxxxxx
Xbbbxxxxxxxxxxxxxxxx
Xbbbxxxxxxxxxxxxxxxx
"Sheet4"Description
Xbbbxxxxxxxxxxxxxxxx
Xbbbxxxxxxxxxxxxxxxx
Xbbbxxxxxxxxxxxxxxxx
"Sheet5"Description
Xbbbxxxxxxxxxxxxxxxx
Xbbbxxxxxxxxxxxxxxxx
Xbbbxxxxxxxxxxxxxxxx

Thanks for the help.
Gonçalo
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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