VBA to Copy Sheet Based on Cell Drop Down to matching Sheet Name

Hawkeye_28

New Member
Joined
Jun 3, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have created a new forecast model (Sheet Name: New FC), which i will need to update periodically. Once i have submitted this copy i want to copy and paste the sheet as values to the respective period sheet name i.e. 3+9, 4+8, 5+7, 6+6, 7+5,8+4, 9+3,10+2, 11+1, based on a drop down field located in cell B4 in "New FC" sheet. I will then be able to always have a copy of my submission - it would be good to have a time stamp on when it was copied and pasted to each respective sheet.

I have been trying to amend a code i found on the message boards which is applicable for searching rows and pasting them into their respective sheets, however i cannot figure out how to just simply paste the whole sheet into the correct existing sheet based on the drop down value;

VBA Code:
[CODE=vba]
Sub Do_it()

Dim rs As Worksheet
Set rs = Worksheets("Sheet8")

For r = 1 To rs.Range("A" & Rows.Count).End(xlUp).Row
wsName = rs.Cells(r, "A")

If WorksheetFunction.IsErr(Evaluate("'" & wsName & "'!A1")) = "False" Then 'worksheet exists write data
    wr = Worksheets(wsName).Range("A" & Rows.Count).End(xlUp).Row + 1
    rs.Rows(r).Copy Destination:=Worksheets(wsName).Range("A" & wr)
End If

Next r

MsgBox "Done"

End Sub
[/CODE]

Any help much appreciated
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,214,788
Messages
6,121,603
Members
449,038
Latest member
Arbind kumar

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