Re-post [VBA] Copy selection to multiple worksheets except two

emmetje

New Member
Joined
Feb 12, 2014
Messages
12
Can someone please help me?
In the last part of the code I want to copy a selection from 1 worksheets to all other worksheets except two. But the macro stops at the selection and doesn't copy at all. I get no error message. Can someone please tell me what the correct code should be?

Thx.



Sub VakantiekaartenNaarNieuwJaar()
'
' VakantiekaartenNaarNieuwJaar Macro
'
' Keyboard Shortcut: Ctrl+k
'
'OPEN BESTAND
Workbooks.Open Filename:= _
"LOCATION\2014.xls", _
UpdateLinks:=0
'BEVEILIGING WERKBLADEN OPHEFFEN
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Unprotect Password:="PASSWORD"
Next ws
'
'JAARTAL INVOEREN
'
Sheets("Totaal").Select
Range("B3:G3").Select
ActiveCell.FormulaR1C1 = "2014"
Range("B4").Select
'
'BASISBESTAND OPENEN, BLANCO KAART NAAR HUIDIG BESTAND KOPIEREN EN BASISBESTAND SLUITEN
'
Workbooks.Open Filename:= _
"LOCATION\_Vakantiekaartenbestand 2014.xls"
Windows("_Vakantiekaartenbestand 2014.xls").Activate
Sheets("Blanco kaart").Select
Sheets("Blanco kaart").Copy Before:=Workbooks("2014.xls").Sheets("Totaal")
Windows("_Vakantiekaartenbestand 2014.xls").Activate
Windows("_Vakantiekaartenbestand 2014.xls").Close False
'
'RELEVANTE CELLEN UIT BLANCO KAART KOPIEREN NAAR ALLE WERKBLADEN IN HUIDIG BESTAND
'
Workbooks("2014.xls").Activate
Sheets("Blanco kaart").Activate
Range("Y4:Z10").Select
For Each ws In Workbooks("2014.xls").Worksheets
If ws.Name <> "Blanco kaart" And ws.Name <> "Totaal" Then
Selection.Copy Destination:=ws.Cells(Selection.Row, Selection.Column)
End If
Next
End Sub
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Forum statistics

Threads
1,216,082
Messages
6,128,713
Members
449,464
Latest member
againofsoul

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