Results 1 to 2 of 2
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hans remember my old prob to order sheets? (2000 sr 1)

    ... My friend have make this:

    Sub Test()

    Dim SheetNames()
    Dim i As Integer
    Dim x As Variant
    Dim j As Integer
    Dim Temp As Variant
    With ThisWorkbook
    ReDim Preserve SheetNames(1 To .Sheets.Count)
    For i = LBound(SheetNames) To UBound(SheetNames)
    On Error Resume Next
    With .Sheets(i)
    x = DateValue(WorksheetFunction.Substitute(.Name, "_", "-"))
    If Err = 0 Then
    SheetNames(i) = x
    Else
    Err.Clear
    SheetNames(i) = .Name
    End If
    End With
    On Error GoTo 0
    Next i
    For i = LBound(SheetNames) To UBound(SheetNames) - 1
    For j = i + 1 To UBound(SheetNames)
    If SheetNames(i) > SheetNames(j) Then
    Temp = SheetNames(j)
    SheetNames(j) = SheetNames(i)
    SheetNames(i) = Temp
    End If
    Next j
    Next i
    For i = LBound(SheetNames) To UBound(SheetNames)
    If IsDate(SheetNames(i)) Then
    SheetNames(i) = Format(SheetNames(i), "mmmm_yyyy")
    .Sheets(SheetNames(i)).Move Sheets(i)
    End If
    Next i
    End With
    End Sub

    This code work but order also a sheets not important for me: LISTA, SERVIZIO and CONTROLLO.
    Is possible to exclude this 3 sheets from macro?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Hans remember my old prob to order sheets? (2000 sr 1)

    Check your threads from last month. I already created code to exclude sheets for you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •