find last entry in a column


  1. Posts : 174
    microsoft windows 10
       #1

    find last entry in a column


    Hi all, I have a column and I want to find the last entry and add some text to the last entry offset 3 down.
    Could you tell me how to do it please?.
    Len
      My Computer


  2. Posts : 16,950
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #2

    Len,

    I assume you mean that you want VBA to do this.
    - I have posted code for finding the last entry assuming the column concerned is column A.
    - To get your offset you will need to manipulate LastRowUsed
    - To add text you will have to manipulate that cell's .Value

    Code:
    Sub FindLastRowUsedDespiteAnyBlanks()
    Dim LastRowUsed
    'this returns the last row used in column A [e.g. of Sheet1] even if there are blanks in some cells
    'Sheets("Sheet1").Select 'May not be necessary
    ActiveSheet.Select
    If Cells(1, "A").Value = "" Then
    LastRowUsed = 0
    Else
    LastRowUsed = Cells(Rows.Count, "A").End(xlUp).Row
    End If
    MsgBox LastRowUsed
    End Sub
    Denis
      My Computer


  3. Posts : 174
    microsoft windows 10
    Thread Starter
       #3

    Thankyou Denis that worked just fine for me.
    Len
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 12:31.
Find Us




Windows 10 Forums