sexta-feira, 17 de fevereiro de 2012

Como Navegar entre os registros

Boa Noite pessoal, hoje estaremos incluindo os botões avançar e recuar na planilha de cadastro, espero que gostem. Este procedimento pode ser aplicado em formulários, como iremos mostrar mais adiante.
Espero que curtam a macro.

Sub Avancar()

Dim total As Variant
total = (Cells(Rows.Count, 1).End(xlUp).Row) - 1
     If ActiveCell.Row > total Then
         MsgBox "Final da listagem"
    Else
         Cells(ActiveCell.Row, 1).Offset(1, 0).Select
      
    End If
end sub

=======================

Sub Recuar()
Dim total As Variant
total = (Cells(Rows.Count, 1).End(xlUp).Row) - 1
     If ActiveCell.Row = 2 Then
         MsgBox "Início da listagem"
    Else
         Cells(ActiveCell.Row, 1).Offset(-1, 0).Select
    End If
End Sub

Nenhum comentário:

Postar um comentário

Pesquisar este blog