Posts by xlers

    i have a code to copy the active sheet multiple time(user defined) after the same active sheet but dont know why it is giving error



    Sub CopysheetMultipleTimes()

    Application.DisplayAlerts = False

    Application.ScreenUpdating = False


    Dim i As Variant

    Dim p As Integer

    Dim sh As Worksheet

    Set sh = ThisWorkbook.ActiveSheet

    On Error GoTo out

    i = Application.InputBox("How many copies do you what?", "Rochem Inspectors")

    If i = False Then GoTo out

    p = 0

    Do

    ActiveSheet.Copy After:=ActiveWorkbook.Worksheets(sh)

    p = p + 1

    Loop Until p = i

    Exit Sub

    out:

    MsgBox "Copy Was Cancelled", , "Rochem Inspectors"


    Application.DisplayAlerts = True


    Application.ScreenUpdating = True

    End Sub

    i have a list of sheets and in front a checkbox symbol is there whoose value is R

    i need a code that selects all the sheets whose checkbox is R and create a pdf for all the selected sheets combine. here is my code but it is giving error subsript out of range on sheets(sharray).select