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
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