Notifications
Clear all

Range (Célula inicial fixa até ultima linha)

2 Posts
1 Usuários
0 Reactions
1,098 Visualizações
(@felipesalomao)
Posts: 103
Estimable Member
Topic starter
 

Olá Pessoal, estou desenvolvendo um código:

Sub testesdiversos()
Dim LastRow As Long
Application.ScreenUpdating = False
Application.EnableEvents = False
 With ActiveSheet
    LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
    LastRow = LastRow - 21
    LastRow = LastRow
    
    Range("C22:C" & LastRow).Select
    Range("B17").Value = LastRow
 End With
Application.EnableEvents = True
End Sub

Está dando erro na linha: Range("C22:C" & LastRow).Select

Eu sei que a linguagem está errada, meu objetivo é que selecione a célula C22 até a LastRow, Obs LastRow é a ultima linha -21.

Vlw !!

 
Postado : 20/08/2012 11:37 pm
(@felipesalomao)
Posts: 103
Estimable Member
Topic starter
 

Consegui fazer tentando aqui:

Sub testesdiversos()
Dim LastRow As Long
Application.ScreenUpdating = False
Application.EnableEvents = False
 With ActiveSheet
    LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
 

    
    Range("C22", Cells(LastRow, 3)).Select
    Range("B17").Value = LastRow
 End With
Application.EnableEvents = True
End Sub

Ou seja o que funcionou foi: Range("C22", Cells(LastRow, 3)).Select

Vlw

 
Postado : 20/08/2012 11:56 pm