Announcement

Collapse
No announcement yet.

Reference Cell In Macro Using Row & Column Numbers From Cell

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reference Cell In Macro Using Row & Column Numbers From Cell

    I can't seem to think straight on this one...

    I'm trying to reference a location on a spreadsheet in a macro by using the values in two cells (the idea is to then paste to this location):

    D2 is 17 (the row)
    B4 is 2 (the column)

    therefore the location is B17 (R17C2), but can I get this to work...? The values in these cells can change depending on selections made which is why I want to use the cell references rather than the absolute!

    Any help would be appreciated.
    Thanks, Pete

  • #2
    Re: Referencing A Location From Two Cell Values

    I'm not quite sure I understand, but
    Code:
    cells(row,column)
    returns a range with coordinates row (as a number) and column (as a number).

    Comment


    • #3
      Re: Referencing A Location From Two Cell Values

      Hi,

      Dim r   As Long, c  As Long
      r = Range("D2")
      c = Range("B4")
      MsgBox Cells(r, c)
      Kris

      ExcelFox

      Comment


      • #4
        Re: Referencing A Location From Two Cell Values

        Thanks Kris & Great Big Bear - problem solved thanks to you guys!

        Comment

        Working...
        X