+ Reply to Thread
Results 1 to 4 of 4

Use ActiveCell from former sheet in formula

  1. #1
    Registered User
    Join Date
    08-11-2010
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    11

    Use ActiveCell from former sheet in formula

    Hi,

    I need to use the ActiveCell from sheet1 (highlighted in red) in a vlookup entered into a cell in sheet 2. The ActiveCell I want to use will change in every loop until the end of a list. Can you help?


    Sub Test2()
    Sheets("Sheet1").Select
    Range("B8").Select
    Do Until IsEmpty(ActiveCell)
    Sheets("Sheet2").Select
    Range("O4").Select
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(ActiveCell,'Sheet1'!C[-13]:C[-12],2,FALSE)"
    Sheets("Sheet1").Select
    ActiveCell.Offset(1, 0).Select
    Loop
    End Sub
    Last edited by rubix; 08-26-2010 at 07:52 AM.

  2. #2
    Registered User
    Join Date
    08-11-2010
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Use ActiveCell from former sheet in formula

    Please ignore the comments in the script.

    Sub Test2()
    Sheets("Sheet1").Select
    Range("B8").Select
    Do Until IsEmpty(ActiveCell)
    Sheets("Sheet2").Select
    Range("O4").Select
    ActiveCell.FormulaR1C1 = _
    "=VLOOKUP(ActiveCell,'Sheet1'!C[-13]:C[-12],2,FALSE)"
    Sheets("Sheet1").Select
    ActiveCell.Offset(1, 0).Select
    Loop
    End Sub

  3. #3
    Registered User
    Join Date
    08-11-2010
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Use ActiveCell from former sheet in formula

    Any suggestions?

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Use ActiveCell from former sheet in formula

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Remember what the dormouse said
    Feed your head

+ 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