Propósito

✔ Programação GLOBAL® - Quaisquer soluções e/ou desenvolvimento de aplicações pessoais, ou da empresa, que não constem neste Blog devem ser tratados como consultoria freelance. Queiram contatar-nos: brazilsalesforceeffectiveness@gmail.com | ESTE BLOG NÃO SE RESPONSABILIZA POR QUAISQUER DANOS PROVENIENTES DO USO DOS CÓDIGOS AQUI POSTADOS EM APLICAÇÕES PESSOAIS OU DE TERCEIROS.

.: Vitrine

Carregando artigos...

Views

Mostrando postagens com marcador alfabético. Mostrar todas as postagens
Mostrando postagens com marcador alfabético. Mostrar todas as postagens

VBA Excel - Ordenando Alfabeticamente as Abas - Sort all worksheets on the basis of Sheet names

Inline image 1


Quando a nossa aplicação gera novas abas com conteúdo no MS Excel, é importante que ordenemos o resultado. Como?

Sub SortALLSheets()

  'This module will sort all the worksheets present in active workbook.
  Dim iSheet As Long, iBefore As Long

  For iSheet = 1 To ActiveWorkbook.Sheets.count

    Sheets(iSheet).Visible = True

    For iBefore = 1 To iSheet - 1
      If UCase(Sheets(iBefore).Name) > UCase(Sheets(iSheet).Name) Then
        ActiveWorkbook.Sheets(iSheet).Move before:=ActiveWorkbook.Sheets(iBefore)

        Exit For
      End If
    Next iBefore

  Next iSheet

End Sub

Tags: VBA, Excel, ordenar, alfabético, sort, worksheets, 



VBA Excel - Extraindo Caracteres Alfabéticos - Extract Alphabets (Remove Digits) from Selected Range


Inline image 1





Segue código para extrair caracteres alfabéticos:

Function ExtAlpha (ByVal cell As String) As Object
    'This function will extract 1st continuous set of digits.

    Dim i As Long, flag As Long

    Let flag = 0
    Let ExtAlpha = ""

    For i = 1 To Len(cell)
            If (Asc(Mid(cell, i, 1)) >= 65 And Asc(Mid(cell, i, 1)) <= 90) Or (Asc(Mid(cell, i, 1)) >= 97 And Asc(Mid(cell, i, 1)) <= 122) Then
                Let flag = 1
                Let ExtAlpha = ExtractAlpha & Mid(cell, i, 1)
            Else
                If flag = 1 Then Exit Function
            End If
    Next i
End Function


Tags: VBA,  Text, User Defined Function (UDF), VBA Macro, caractere, alfabético


diHITT - Notícias