Notifications
Clear all

Duvida - Variavel localizar ultima coluna preenchida

2 Posts
2 Usuários
0 Reactions
753 Visualizações
(@jokerpot)
Posts: 132
Estimable Member
Topic starter
 

Pessoal!

O codigo abaixo identifica a ultima linha preenchida em uma planlha:

n_lastrow_for = Sheets("Plan1").Range("A100000").end(xlUP).Row

Gostaria de saber qual o codigo utilizar para descobrir a ULTIMA COLUNA PREENCHIDA??

Abraços,

 
Postado : 04/03/2015 1:52 pm
Fernando Fernandes
(@fernandofernandes)
Posts: 43750
Illustrious Member
 

Boa tarde!

Tente
Fonte: http://www.globaliconnect.com/excel/ind ... Itemid=475
Fonte: http://www.rondebruin.nl/win/s9/win005.htm

Sub UltCol()
    Dim LastColumn As Long
    With ActiveSheet.UsedRange
        LastColumn = .Columns(.Columns.Count).Column
    End With
    MsgBox LastColumn
End Sub

Att

Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel

 
Postado : 04/03/2015 2:07 pm