Help wtih Macros/Auto Name/Copy Conditional Formats

Jewwels

New Member
Joined
Apr 10, 2019
Messages
1
I have a workbook that I want the worksheets to auto name with the date and copy the conditional formatting to the next worksheet. My problem is that the name of the worksheet isn't naming correctly but the conditional formatting is working. I have two macros. I am not sure if the second macro is the culprit.

Code:
    Sub CopyDayForward()
    '
    ' CopyDayForward Macro
    '
    ' Keyboard Shortcut: Ctrl+Shift+F
    '
        ActiveWindow.SmallScroll Down:=24
        Range("A1:U65").Select
        Range("U65").Activate
        Selection.Copy
        xCurrentSheetDate = Format(DateValue(Right(ActiveSheet.Name, 2) + "-" + Mid    
           (ActiveSheet.Name, 10, 4) + "-" + Mid(ActiveSheet.Name, 5, 4)) + 1, "yyyy mmm dd")
        Sheets.Add(After:=ActiveSheet).Name = "PAVE " & xCurrentSheetDate
        ActiveSheet.PasteSpecial xlPasteAllMergingConditionalFormats
        ActiveSheet.PasteSpecial xlPasteColumnWidths
        Columns("A:A").ColumnWidth = 8.29
        Columns("A:A").EntireColumn.AutoFit
        ActiveWindow.SmallScroll ToRight:=8
        ActiveSheet.Buttons.Add(1629, 5.25, 100.5, 25.5).Select
        Application.CutCopyMode = False
        Selection.OnAction = "CopyDayForward"
        ActiveSheet.Shapes("Button 1").IncrementLeft -3
        ActiveSheet.Shapes("Button 1").IncrementTop -3
        Selection.Characters.Text = "Copy Day Forward"
        With Selection.Characters(Start:=1, Length:=16).Font
            .Name = "Calibri"
            .FontStyle = "Bold"
            .Size = 11
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ColorIndex = 3
    
    
   End With
   End Sub

[code] 
    Sub Create()
        Dim I As Long
        Dim xNumber As Integer
        Dim xNumber As String
        Dim xActiveSheet As Worksheet
        On Error Resume Next
        Application.ScreenUpdating = False
        Set xActiveSheet = ActiveSheet
        xNumber = InputBox("Inter number of times to copy the current sheet")
        For I = 1 To xNumber
            xName = ActiveSheet.Name
            xActiveSheet.Copy After:""ActiveWorkbook.Sheets(xName)
            ActiveSheet.Name = "Template-" & I
            Next
            xActiveSheet.Activate
            Application.ScreenUpdating "True"
        
    End Sub
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,223,231
Messages
6,170,885
Members
452,364
Latest member
springate

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