+ Reply to Thread
Results 1 to 4 of 4

Finding the last used row of a column, using this value to place text down another column

Hybrid View

  1. #1
    Registered User
    Join Date
    10-19-2012
    Location
    Manchester, England
    MS-Off Ver
    Excel 2010
    Posts
    22

    Finding the last used row of a column, using this value to place text down another column

    Hi I have been going round in circles with this one can anyone help?
    In column A I have a certain number of values (this can vary ). Lets say Column A has data down to row 22. I would like "N/A" to be placed in the column B and H starting from B2 and H2: to the end of the range located in A, in this case 22.

    I can find the end of column A with vba but I can not figure out how to autofill down column B and H with "N/A".

    I have attached a spreadsheet just to make it bit more clearer. (I am using excel 2007)

    Thanks for looking
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Finding the last used row of a column, using this value to place text down another col

    Hi!

    Do you need simple "N/A" string or you need N/A error in columns B and H?

    Buran
    If you are pleased with a member's answer then use the Star icon to rate it.

  3. #3
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Finding the last used row of a column, using this value to place text down another col

    Here it is if you need N/A error

    Sub FillNA()
        Dim lngLastRow As Long
        lngLastRow = Range("A" & Rows.Count).End(xlUp).Row
        If lngLastRow > 1 Then
            Range("B2:B" & lngLastRow).Formula = "=NA()"
            Range("H2:H" & lngLastRow).Formula = "=NA()"
        End If
    End Sub
    and here it is, if you need simple N/A string

    Sub FillNA()
        Dim lngLastRow As Long
        lngLastRow = Range("A" & Rows.Count).End(xlUp).Row
        If lngLastRow > 1 Then
            Range("B2:B" & lngLastRow).Value = "N/A"
            Range("H2:H" & lngLastRow).Value = "N/A"
        End If
    End Sub

  4. #4
    Registered User
    Join Date
    10-19-2012
    Location
    Manchester, England
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: Finding the last used row of a column, using this value to place text down another col

    Hi Buran,

    N/A as a string so the bottom code worked wonderful. Thank you for your help

+ 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