0

I found a method online of finding the last row in a chart using the following code

Cells.Find("*", Range("A1"), xlValues, xlWhole, , xlPrevious).Row

How can I adapt this to find the last cell in a particualr column, say G for example, I've tried changing the range, but it hasn't produced expected results

KOM
  • 511
  • 1
  • 6
  • 9

1 Answers1

0

The code below should help find the last row in column G of the active sheet:

'Find the last used row in a Column: column G in this example
Sub LastRowInOneColumn()
    Dim LastRow As Long
    With ActiveSheet
        LastRow = .Cells(.Rows.Count, "G").End(xlUp).Row
    End With
    MsgBox LastRow
End Sub

It was taken from http://www.rondebruin.nl/win/s9/win005.htm which is a very useful article for finding last columns and rows in your sheet.

The following SO Q&As are also a very useful resource for what you're looking for:

Community
  • 1
  • 1
djikay
  • 10,450
  • 8
  • 41
  • 52
  • Superb, I'd looked at the first site you posted, but must have missed something when I first attempted it, because it works now. – KOM Aug 07 '14 at 09:43
  • @SuperKOM: I'm glad I was able to help. Good luck! – djikay Aug 07 '14 at 09:47