+ Reply to Thread
Results 1 to 3 of 3

Last 10 Macro Not Working On Column With Formula In Cells

  1. #1
    Registered User
    Join Date
    06-20-2015
    Location
    Stevenage
    MS-Off Ver
    2013
    Posts
    5

    Unhappy Last 10 Macro Not Working On Column With Formula In Cells

    Dear All,

    I am new to VBA programming but basically what I'm trying to do is select the last 10 entries from a specified column. The problem I have is that the code works for data that I have entered manually, but where data is derived from a formula, it is returning the wrong data set. The coding I'm using is as follows:

    Sub Last_10()
    '
    ' Last_10 Macro
    '
    Dim LR As Long
    LR = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
    ActiveSheet.Range("A" & (LR - 9) & ":A" & LR).Copy Destination:=ActiveSheet.Range("x7")

    LR = ActiveSheet.Range("l" & Rows.Count).End(xlUp).Row
    ActiveSheet.Range("l" & (LR - 9) & ":l" & LR).Copy Destination:=ActiveSheet.Range("y7")

    Range("A1:A1").Select
    '
    End Sub

    Column I is the column where data is derived from a formula, column A is just date entries.

    Any help will be very much appreciated

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,526

    Re: Last 10 Macro Not Working On Column With Formula In Cells

    Attaching a sample workbook enables others to work on your problem:

    To attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

    To add a file to a new post

    To add a file to an existing post.

  3. #3
    Registered User
    Join Date
    06-20-2015
    Location
    Stevenage
    MS-Off Ver
    2013
    Posts
    5

    Re: Last 10 Macro Not Working On Column With Formula In Cells

    Thanks davesexcel.

    see attached.

    Thanks
    Attached Files Attached Files

+ 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. Correct/Working (Index,Match) formula not working between cells
    By barnerd in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 02-11-2014, 01:20 PM
  2. Formula/macro to edit cells in one column based on contents of a cell in another column
    By robbyvegas in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-25-2012, 06:10 AM
  3. Need copy the column d instead of column b, macro working fine for column b
    By audax48 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-20-2012, 04:32 PM
  4. Formula/macro - Apply certain formula as per duplicate cells in column L
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-10-2011, 12:28 AM
  5. Macro or Formula to delete empty cells in a column of data
    By Cougar548 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-02-2005, 10:19 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