+ Reply to Thread
Results 1 to 6 of 6

loop range in sheet 3 to find value and copy offset cell to sheet 2

  1. #1
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    loop range in sheet 3 to find value and copy offset cell to sheet 2

    I am having trouble trying to set up some code to carry out the following task.

    I would like to loop through a range in sheet 2 column G and if the cell I am currently on is less than the predetermined AVAge variable I want the value in column A (same row) to be copied to the last empty row in Sheet 2 column A.

    I am struggling with the jumping from one sheet to another and having to reset the variables for last row in sheet 2 after each paste. The below is the latest unsuccessful attempt. If anyone can suggest anything to solve this issue I would be greatly appreciative.

    Please Login or Register  to view this content.
    The complete code is below incase you were confused about data types or previously declared values

    Please Login or Register  to view this content.
    Last edited by Sc0tt1e; 06-27-2017 at 09:30 PM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: loop range in sheet 3 to find value and copy offset cell to sheet 2

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: loop range in sheet 3 to find value and copy offset cell to sheet 2

    Quote Originally Posted by AlphaFrog View Post
    Please Login or Register  to view this content.
    Note: your code loops through the sheet(3) rows from the bottom up. I didn't know if that's what you actually want. Bottom-up loops are typically used when rows are deleted.

  4. #4
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Usually at work, in the UK
    MS-Off Ver
    Excel 2010
    Posts
    639

    Re: loop range in sheet 3 to find value and copy offset cell to sheet 2

    It is because after I copy the line across I want to delete the entire row

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: loop range in sheet 3 to find value and copy offset cell to sheet 2

    I would do it like this because now you take the Rows.Count also from Sheet2.
    It's my personal experience that when not specifying the exact sheet Rows.Count sometimes messes up things.

    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: loop range in sheet 3 to find value and copy offset cell to sheet 2

    Quote Originally Posted by bakerman2 View Post
    It's my personal experience that when not specifying the exact sheet Rows.Count sometimes messes up things.
    I've never experienced any issues with that.

+ 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. [SOLVED] Copy range to new sheet and offset each cell in range
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-13-2017, 09:21 AM
  2. Copy range of cells from sheet to another sheet using offset
    By Biplab1985 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-29-2016, 04:56 PM
  3. Copy range of cells from sheet to another sheet using offset
    By Biplab1985 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-29-2016, 01:57 PM
  4. Loop to find a cell, then copy offset paste
    By mr.alexander in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-29-2013, 08:48 AM
  5. Code To Find and Offset works on first sheet but won't loop to other sheets
    By mgaworecki in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-10-2009, 03:02 PM
  6. [SOLVED] Loop Through A Range, Find Cells > 1, Copy Offset To Another Sheet
    By bugmenot in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-25-2008, 06:30 PM
  7. From cell in sheet 2 find name in sheet 1 and value offset
    By Frank345 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-05-2008, 01:50 AM

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