@Basole , eu consegui unificar o código e acredito que esteja funcionando:
Option Explicit
Private Sub CommandButton1_Click()
Dim rng As Range, o que As String, v As Variant
For Each v In Split(txtSetor.Text)
If Not Application.CheckSpelling(v) Then _
MsgBox "'" & v & "' não é uma palavra válida.", _
vbExclamation, "Atenção"
Next v
txtSetor.Text = spellCheck(txtSetor.Text)
txtSetor.Text = shOrtografia.Range("A1").Value2
With Sheets("Setores")
o que = txtSetor.Text
Set rng = .Columns(1).Find(o que, LookIn:=xlValues)
If rng Is Nothing Then
Application.ScreenUpdating = False
Sheets("Setores").Select
Range("A3").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromRightOrBelow
Range("A3").Value = txtSetor.Value
Range("A2").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWorkbook.Worksheets("Setores").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Setores").Sort.SortFields.Add Key:=Range("A2" _
), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Setores").Sort
.SetRange Range("A2:A50")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("A2").Select
Sheets("PAM GUT 2017").Select
MsgBox "Novo setor adicionado!"
txtSetor.Value = Empty 'Null
Else
MsgBox "Setor " & txtSetor.Value & " já existe!!", 64, "Atenção"
End If
End With
End Sub
Porém estou enfrentando um problema em uma ferramenta que você inseriu que achei muito útil, quando a pessoa incluir uma palavra inexistente, abre corretor. Até aí tudo bem, o problema que estou vendo é que quando abre a Verificação de Ortografia e se eu tento cancelar, ele inclui do mesmo jeito o nome errado.
Teria como mudar para quando cancelar a ortografia cancelar o evento inteiro?
PAM GUT 2017 form_1.rar