dimanche 24 octobre 2021

Check box not copying

I'm using a module to copy one sheet to many, but it doesn't copy the check box I have in the sheet, although if I manually select all and copy it does. Can someone explain why its not working in the VBA script, and if possible, how to get it to work?

Here is the script I am running:

Sub Button4_Click()

Const ExclusionsList As String = "Main,Source," _ & "Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday"

Dim Wbk As Workbook
Dim WshSrc As Worksheet
Dim WshTrg As Worksheet
Dim Exclusions() As String
Dim n As Long

Set Wbk = ThisWorkbook
Set WshSrc = Wbk.Worksheets("Source")
Exclusions = Split(ExclusionsList, ",")

Application.ScreenUpdating = False

For Each WshTrg In Wbk.Worksheets
    If IsError(Application.Match(WshTrg.Name, Exclusions, 0)) Then
        WshSrc.Cells.Copy
        With WshTrg
            .Cells.PasteSpecial Paste:=xlPasteAll
            Application.Goto .Cells(1), 1
        End With
    End If
Next

Application.Goto Worksheets("Main").Cells(1), 1

Application.ScreenUpdating = True

End Sub




Aucun commentaire:

Enregistrer un commentaire