Boa noite!!
Acerte este
Private Sub Worksheet_Change(ByVal Target As Range)
'Classificação automatica
'Dim lrow As Long
'lrow = Range("A" & Rows.Count).End(xlUp).Row
'If Range("F" & lrow).Value <> "" Then 'Se os dados for preenchidos de A até D
' [A2:F1000].Sort Key1:=[E1], Order1:=xlAscending 'será feito a classificação
'End If
Call Alt_Class
End Sub
É aqui que falei!!
Sub Alt_Class()
Dim lrow As Long
lrow = Range("A" & Rows.Count).End(xlUp).Row
Columns("E:E").Select
Selection.TextToColumns Destination:=Range("E1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1), DecimalSeparator:=".", ThousandsSeparator:=",", _
TrailingMinusNumbers:=True
Selection.NumberFormat = _
"_([$$-1004]* #,##0.00_);_([$$-1004]* (#,##0.00);_([$$-1004]* ""-""??_);_(@_)"
ActiveWorkbook.Worksheets("Sheet1").Range("A1:E" & lrow).Select
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("E2:E" & lrow) _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("A1:E" & lrow)
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("E1").Select
End Sub
Cole lá em seu modulo.
Att
Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel
Postado : 01/04/2012 6:41 pm