cmax21

New Member
Joined
Oct 7, 2015
Messages
1
Hi,

I created a macro that copy and paste information into another workbook based on a dropdown selection made by a user. Once the selection has been chosen the user can run the macro and it will copy the information selected into a separate book and formatted. However, if the user then wants to make a different selection the original workbook needs to be closed and re-opened for the macro to work again. The reason being that when the macro copies the information it paste it to book1. Once book1 is open, I can’t rerun the macro. Do you know if there is a syntax I can write into the macro that will allow to rerun the macro even if book one is open? Below is the macro syntax.

Sub Create_ ScheduleA()
'
' Create _ScheduleA Macro
'

'
Sheets("Schedule").Select
Sheets("Book").Visible = True
Sheets(Array("Schedule", "Book", "Disclosures")).Select
Sheets("Disclosures").Activate
Sheets(Array("Schedule", "Book", "Disclosures")).Copy
Sheets("Book").Select
Sheets("Book").Name = "ScheduleA"
Sheets("Services").Select
Windows("ScheduleA.xlsm").Activate
Sheets("Services").Select
Columns("F:F").ColumnWidth = 7
Range("C15:F15").Select
Selection.AutoFilter
ActiveSheet.Range("$C$15:$F$133").AutoFilter Field:=4, Criteria1:="<>"
ActiveWindow.SmallScroll Down:=3
Range("C15:E135").Select
Selection.Copy
Windows("Book1").Activate
Range("B15").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll Down:=-6
Range("A1").Select
Sheets("Schedule").Select
Windows("Schedule.xlsm").Activate
Application.CutCopyMode = False
Selection.AutoFilter
Columns("F:F").Select
Selection.EntireColumn.Hidden = True
ActiveWindow.SmallScroll Down:=-12
Range("A1").Select
Sheets("Book").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Create_ClientFriendly_Guide").Select
Windows("Book1").Activate
End Sub
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce

Forum statistics

Threads
1,215,882
Messages
6,127,538
Members
449,385
Latest member
KMGLarson

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