+ Reply to Thread
Results 1 to 9 of 9

Macro that helps me detect the last column with information

  1. #1
    Forum Contributor
    Join Date
    06-04-2015
    Location
    Bangkok, Thailand
    MS-Off Ver
    2013
    Posts
    175

    Macro that helps me detect the last column with information

    Hi All,

    Is there a macro that can help me detect the last column with information and then copy and paste data into the column to the right of that?

    For example, I have information in column A and each week this information changes so I have been copying and pasting this information into the next blank column every week.

    Now I have information in columns B to Z so this week I will insert a column then copy and paste A's information into column AA and this will update my graph.

    Basically my graph now extends to AA so when I insert a column my graph will go to AB and I can paste the newest information into AA.

    Not sure if this is the best way to do it but since I have around 35-40 graphs to update each week, this was the solution I came up with although in my graph there is always a blank at the end of the graph since it is linked to a blank column.

    To summarize I have information in column A updated each week, my graph is linked to B-AA but there is only information in B-Z, I insert a column after AA (so new graph is B-AB) and I paste the updated info in A into AA.

    Hope that is not too confusing.

    Is there a macro that can help with this? Or better yet is there a macro that can update my graphs without having that blank space at the end. It does not bother me much but it would just help the graph look cleaner. Thank you very very much.

  2. #2
    Valued Forum Contributor
    Join Date
    03-24-2014
    Location
    England
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    575

    Re: Macro that helps me detect the last column with information

    https://www.rondebruin.nl/win/s9/win005.htm

  3. #3
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Macro that helps me detect the last column with information

    To answer the "last column" bit of your question

    Please Login or Register  to view this content.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  4. #4
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Macro that helps me detect the last column with information

    Maybe:

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    06-04-2015
    Location
    Bangkok, Thailand
    MS-Off Ver
    2013
    Posts
    175

    Re: Macro that helps me detect the last column with information

    Thank you all, I am going to try all of your suggestions and then add in a copy paste command

  6. #6
    Forum Contributor
    Join Date
    06-04-2015
    Location
    Bangkok, Thailand
    MS-Off Ver
    2013
    Posts
    175

    Re: Macro that helps me detect the last column with information

    Hi All,

    Sorry my title might have been a bit confusing. I was looking to move to the right of the last column with information in my excel sheet. So if my last column with info was AA, I'm looking for a macro that detects AA, moves to AB and then I can use a copy paste command (copy from A into AB or whatever the latest column is)

  7. #7
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Macro that helps me detect the last column with information

    If your longest row is row 1, try this code

    Please Login or Register  to view this content.
    its directly analogous to the standard

    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  8. #8
    Forum Contributor
    Join Date
    06-04-2015
    Location
    Bangkok, Thailand
    MS-Off Ver
    2013
    Posts
    175

    Re: Macro that helps me detect the last column with information

    I'm using this code now:

    Please Login or Register  to view this content.
    But it the graph won't update, it seems to insert and copy but the graph does not seem to pick up the "insert part" . Not sure what is wrong here.

  9. #9
    Forum Contributor
    Join Date
    06-04-2015
    Location
    Bangkok, Thailand
    MS-Off Ver
    2013
    Posts
    175

    Re: Macro that helps me detect the last column with information

    Very odd.. when I manually insert a column the graph will update but when I use the code above, the graph won't. Any idea why?

+ 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] VBA to detect next empty cell in column and add formula, then repeat for next column, ...
    By Marijke in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-17-2013, 07:28 AM
  2. Replies: 12
    Last Post: 01-31-2013, 03:30 PM
  3. Replies: 5
    Last Post: 01-24-2013, 12:28 AM
  4. Help: Macro or function that helps match an inputted name with names in a master list
    By TaskinRahman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-10-2012, 03:03 PM
  5. [SOLVED] How to mend the excel macro that helps me scheduling movies
    By csattila in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-02-2012, 10:49 AM
  6. Replies: 0
    Last Post: 09-18-2012, 11:47 AM
  7. Replies: 4
    Last Post: 04-12-2012, 01:10 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