+ Reply to Thread
Results 1 to 4 of 4

Pull data from changing column each day

  1. #1
    Registered User
    Join Date
    02-13-2015
    Location
    Baltimore, MD
    MS-Off Ver
    Excel for Mac 2011
    Posts
    43

    Pull data from changing column each day

    I have a pretty complicated (for me) spreadsheet that I am working on. I am stuck on the final piece. Each day, sales are updated in a spreadsheet, and it creates an additional column. In one of my macros, I go to the sales tab, click on a blank cell, and than CMD-Left Arrow to get to the last cell in the column, and than copy the copy and have the macro do its work. Problem is the macro doesnt see it as the last column, it sees it as column F or whatever. Is there a way to have it pull data from the last column, which changes each day in a macro?

    Range("P2").Select
    Selection.End(xlToLeft).Select
    Range("H2:H5").Select
    Selection.Copy
    ActiveWindow.SmallScroll Down:=-1
    Range("I2").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False

    The H2:H5 is the issue. Each day a column will be added, so tomorrow it will I, than J, etc. I thought by clicking on a cell than CTRL and left arrow would "trick" the macro into doing what I want, but I am incorrect.

    This is what Im (trying to) use now.
    Attached Images Attached Images
    Attached Files Attached Files

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Pull data from changing column each day

    Hi ckserra,

    Watch this:

    Dim LastColumn as Double
    Dim LastRow as Double
    LastColumn = Cells(1,Columns.Count).End(xlToLeft).Column ' This will give column of last data entered in row 1
    LastRow = Cells(Rows.Count,LastColumn).End(xlDown).Row ' This will give last row (or first blank row) in the last column

    Range(Cells(1,LastColumn),Cells(LastRow,LastColumn).Select

    Cells(2,LastColumn + 1).Select

    I hope the above gives you enough code to do what you need.

    I'm not sure it is exactly what you need for your problem but should give you some ideas.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    02-13-2015
    Location
    Baltimore, MD
    MS-Off Ver
    Excel for Mac 2011
    Posts
    43

    Re: Pull data from changing column each day

    Great, thank you very much Marvin! I am very new to vba, but have used macros for a while. I will give this a shot.

    Thanks again!

    Chris

  4. #4
    Registered User
    Join Date
    02-13-2015
    Location
    Baltimore, MD
    MS-Off Ver
    Excel for Mac 2011
    Posts
    43

    Re: Pull data from changing column each day

    Ok so I can get i to select a cell in the last column, but what I need is for it to copy the entire column, and I am struggling with that. Any help would be much appreciated.

+ 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] Pull data from changing column each day
    By ckserra in forum Excel General
    Replies: 6
    Last Post: 08-22-2017, 11:26 PM
  2. Replies: 5
    Last Post: 01-26-2014, 09:36 PM
  3. attempting to pull data from column G conditional of name in Column A
    By exceln00b123 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-01-2013, 08:04 PM
  4. Replies: 6
    Last Post: 03-04-2013, 11:25 AM
  5. Macro that can be re-used to pull data from a changing model
    By balston2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-07-2013, 05:23 PM
  6. Replies: 2
    Last Post: 02-02-2012, 09:02 AM
  7. Pull row data across to column
    By bigroo1958 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-30-2010, 09:00 PM

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