Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
Kitana pe Simpatie.ro
Femeie
25 ani
Bucuresti
cauta Barbat
25 - 48 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [EXCEL] Go To Last Used Cell in Selected Column [VBA] Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 748
I wanted to create an arrow shape and assign to it a macro to go to last used cell in the selected column.

Assuming you select a cell in column C and click the arrow button, you should go to last used cell / first unused cell in column C.

The following code goes to last used cell in column (equivalent to CTRL+DOWN ARROW press):


Sub GoToLastUsedCell()

Dim LastCell As String

LastCell = ActiveCell.End(xlDown).Address
LastCell = Range(LastCell).Select

End Sub


Modificat de TRaP (acum 5 ani)


pus acum 5 ani
   
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 748
More complicated code:



Sub GoToLastRowCell()

Dim c As Range
Dim LastRow, colNum As Long

With ActiveSheet
    Set c = Selection
    colNum = c.Columns.Column
    LastRow = .Cells(Rows.Count, colNum).End(xlUp).Row
    .Cells(LastRow, colNum).Select
End With

End Sub


NOTE: IF YOU ARE USING A TABLE, IT WILL GO TO THE LAST CELL IN THE TABLE, NOT THE LAST CELL WITH DATA


pus acum 5 ani
   
Pagini: 1  

Mergi la