+ Reply to Thread
Results 1 to 2 of 2

Select Far Right data in a Selected Row

  1. #1
    Registered User
    Join Date
    11-21-2005
    Posts
    1

    Select Far Right data in a Selected Row

    I am very new to Macro's but am trying to modify an existing one inside a spreadsheet I have to update.

    What I have to do is select a range of cells in one row, i.e. D21:DX21. I want to take the data from the farthest right cell in that range that contains data, and place that value in B21.

    Hopefully this is a simple request!!

    Thanks in advance for any help I can get!

  2. #2
    Tom Ogilvy
    Guest

    RE: Select Far Right data in a Selected Row

    I assume you mean with code and not formulas?

    Dim rng as Range
    set rng = Range("DX21")
    if isempty(rng) then
    set rng = rng.End(xltoLeft)
    end if
    if rng.Column >= 4 then
    Range("B21").Value = rng.Value
    else
    Msgbox "Range of interest is empty"
    End if

    --
    Regards,
    Tom Ogilvy




    "tmony" wrote:

    >
    > I am very new to Macro's but am trying to modify an existing one inside
    > a spreadsheet I have to update.
    >
    > What I have to do is select a range of cells in one row, i.e. D21:DX21.
    > I want to take the data from the farthest right cell in that range that
    > contains data, and place that value in B21.
    >
    > Hopefully this is a simple request!!
    >
    > Thanks in advance for any help I can get!
    >
    >
    > --
    > tmony
    > ------------------------------------------------------------------------
    > tmony's Profile: http://www.excelforum.com/member.php...o&userid=28966
    > View this thread: http://www.excelforum.com/showthread...hreadid=537773
    >
    >


+ 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