+ Reply to Thread
Results 1 to 8 of 8

in a function: get content of cell from other sheet with same column but other row

  1. #1
    Registered User
    Join Date
    10-09-2018
    Location
    Asten,Netherlands
    MS-Off Ver
    2010
    Posts
    5

    in a function: get content of cell from other sheet with same column but other row

    I need a selfwritten function that uses the value of row 2 in the column of the actual cell.
    I know I can use Application.ThisCell.Address to find the complete address, and then I get for instance $K$13 or $L$14 or something else, but I need the content of cell K2 (or L2 in case the actual cell is Lxx (where xx can be any value).

    So:
    Function MyFunction()
    MyFunction = Application.ThisCell.Address
    End Function

    And, for instance in K14: =MyFunction() gives as a result $K$14, but I need $K$2
    And in K7: =MyFunction() gives as a result $K$7, but I need $K$2
    So I need always row 2

  2. #2
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: in a function: get content of cell from other sheet with same column but other row

    Hi & welcome to the board.
    How about
    Please Login or Register  to view this content.
    Or, if you want the cell value
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-09-2018
    Location
    Asten,Netherlands
    MS-Off Ver
    2010
    Posts
    5

    Re: in a function: get content of cell from other sheet with same column but other row

    Dear Fluff13,

    Of course! Why didn't I think of that myself?
    Thank you, problem solved.

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: in a function: get content of cell from other sheet with same column but other row

    You're welcome & thanks for the feedback

  5. #5
    Registered User
    Join Date
    10-09-2018
    Location
    Asten,Netherlands
    MS-Off Ver
    2010
    Posts
    5

    Re: in a function: get content of cell from other sheet with same column but other row

    Yet ONE problem remains for me.
    I want to lookup a value in column 7 of the cells A4:H64 in a certain worksheet. The worksheetname will be found in cell $B$1
    I need this function on different worksheets, each worksheet contains another value in $B$1

    Please Login or Register  to view this content.
    For instance in cell K2 I write:
    = MyFunction($B$1)
    because $B$1 contains the name of the worksheet I need to search in.
    Apparently the second parameter: rg.Value & "$A$4:$H$64" is wrong, so MyFunction gives an error...
    Last edited by Mart van Hulten; 12-05-2018 at 11:48 AM. Reason: forgot code-tags

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: in a function: get content of cell from other sheet with same column but other row

    Your post does not comply with Rule 3 of our Forum RULES.

    Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    Please make sure to include the full link, so that other members will be permitted to continue helping you

    Note: Also, please update your posts with code tags.
    HTH
    Regards, Jeff

  7. #7
    Registered User
    Join Date
    10-09-2018
    Location
    Asten,Netherlands
    MS-Off Ver
    2010
    Posts
    5

    Re: in a function: get content of cell from other sheet with same column but other row

    I'm sorry. I'll do that.

  8. #8
    Registered User
    Join Date
    10-09-2018
    Location
    Asten,Netherlands
    MS-Off Ver
    2010
    Posts
    5

    Re: in a function: get content of cell from other sheet with same column but other row

    Problem solved. I simple overlooked a simple solution to the problem...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Matrix: Identify cell content in column for a row if matrix content true
    By deuy2014 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-21-2014, 11:52 AM
  2. [SOLVED] read single cell content from sheet of closed file and put it in a cell on an active sheet
    By rsmith5413 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-09-2014, 04:16 AM
  3. Copying one cell's content and pasting it in the same row and column in another sheet
    By fischbroetchen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-12-2013, 04:04 PM
  4. [SOLVED] filter a sheet by column content, create new sheet with value in filtered cell
    By Footley in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-27-2012, 08:33 PM
  5. [SOLVED] How to autofill a column with a cell content depending on content in another cell.
    By lul1971 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-17-2012, 12:33 PM
  6. [SOLVED] If cell X's content in Sheet A equals to cell Y's content in Sheet B, Then copy some data.
    By sunheroj in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-09-2012, 09:25 AM
  7. based on Cell/Column content ,cut one sheet's values and paste it in other sheet?
    By mindpeace in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-25-2006, 08:33 AM
  8. based on Cell/Column content ,cut one sheet's values and paste it in other sheet?
    By mindpeace in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-24-2006, 10:33 AM

Tags for this Thread

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