Copy Paste scenarios based on cell value

deduwa

Board Regular
Joined
Jul 28, 2015
Messages
110
Hi,

I have 4 tabs and need a code that can do the following (output to be pasted into Sheet1);

(Tab names are Sheet1, Manual, AA, BB)
(Sheet1 has dynamic number of rows)

1. If cell F1 in Manual = 1 then copy range A1:N15 from AA and paste this table into Sheet1 exactly 31 rows below the last cell in column E in the dynamic table

2. If cell F1 in Manual = 2 then copy range A1:N15 from BB and paste this table into Sheet1 exactly 31 rows below the last cell in column E in the dynamic table

When pasting, want to keep existing cell formatting & formulas. I

Additionally, is it possible for the code to use 'Case' so that if over time there comes a point where F1 in Manual = 3, 4, 5 etc, then it will go into a new tab call CC, DD, EE and so on?

Thanks

Ded
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
How about
Code:
Sub ChooseCopy()
   Dim sht As String
   
   sht = Choose(Sheets("Manual").Range("F1"), "AA", "BB")
   Sheets(sht).Range("A1:N15").Copy Sheets("Sheet1").Range("E" & Rows.Count).End(xlUp).Offset(32, -4)
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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