Copy Macro doesn't copy data validation

mlindquist

New Member
Joined
Sep 6, 2019
Messages
15
I have a macro that I'm using to copy two sheets from one work book to another workbook. The copy works - what doesn't work is copying the data validation that I have on one of the sheets where it has a drop down list based on the other sheet?

Any suggestions to make this also copy along with the sheets to the other workbook?

Thanks!
 

Some videos you may like

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

MrTomasz

Board Regular
Joined
May 16, 2014
Messages
84
Office Version
  1. 365
Platform
  1. Windows
you need to use: .PasteSpecial Paste:=xlDataValidation
 

mlindquist

New Member
Joined
Sep 6, 2019
Messages
15
So here is my current VBA - where would I put the code? I tried to put right after the .Copy but that wasn't the correct place

VBA Code:
Sub CopySheets()

myWorkbook = InputBox("Enter Workbook Name")
 
Workbooks("HirerightInvoiceConfirmation.xlsx").Sheets("Confirmation Form").Copy _
    After:=Workbooks(myWorkbook & ".xlsx").Sheets(Workbooks(myWorkbook & ".xlsx").Sheets.Count)
    
Workbooks("HirerightInvoiceConfirmation.xlsx").Sheets("Disputes Reasons").Copy _
    After:=Workbooks(myWorkbook & ".xlsx").Sheets(Workbooks(myWorkbook & ".xlsx").Sheets.Count)
    
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,128,015
Messages
5,628,146
Members
416,294
Latest member
McStuffins

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
Top