+ Reply to Thread
Results 1 to 2 of 2

How to select last active row

  1. #1
    Registered User
    Join Date
    06-27-2005
    Posts
    25

    Question How to select last active row

    Here is my code. I would like to know since every file has a different amount of records, if there is a way process my code only to the last active record?
    In this case here I put 6500 records but I really do have that many records.
    And my record must start with the second record for processing.


    Range("V2").Select
    ActiveCell.FormulaR1C1 = "=CONCATENATE(C[-2],"" "",C[-10],"" "",C[-16])"
    Selection.AutoFill Destination:=Range("V2:V6500"), Type:=xlFillDefault
    Range("V2:V65000").Select
    Selection.Copy
    Range("F2").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Columns("T:Z").Select
    Selection.ClearContents
    Last edited by jcc31; 12-05-2005 at 11:51 PM.

  2. #2
    Registered User
    Join Date
    11-25-2005
    Posts
    23
    Try this:

    Dim cell As Range
    Dim lastCell As Range
    Dim theCells As Range

    Set lastCell = Cells(6500, ActiveCell.Column).End(xlUp) 'find the last active cell, change 6500 up or down to ensure coverage

    Set theCells = Range(Cells(X, ActiveCell.Column), lastCell) 'X is the value of starting row, ie 2 and ActiveCell.Column can be a defined value, i.e "V"

    For Each cell In theCells
    If Not IsEmpty(cell) Then
    'your code to do whatever
    End If
    Next

    HTH

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1