+ Reply to Thread
Results 1 to 10 of 10

Maintain range when inserting columns

  1. #1
    Registered User
    Join Date
    04-13-2009
    Location
    Auckland, New Zealand
    MS-Off Ver
    2010
    Posts
    48

    Maintain range when inserting columns

    I have a macro recorded that inserts into column E in the attached report, and then retrieves data from another worksheet in the workbook. In column D I am trying to keep a 6 month average which includes the latest inserted data, however every time I insert a column the relationship with column D is moved out by one. e.g. range E8:J8 becomes F8:K8.

    I am also stuck with setting up a macro to import a new model into the report. I have set up a worksheet called new model with the manufacturer, model and fail descriptions, however all macros I have recorded fail when trying to insert the manufacturer and model into mulitple cells. I have given up on this, so if you are able to help me out with this as well that would be super helpful.

    thanks
    Last edited by dperry; 10-02-2009 at 02:28 AM.

  2. #2
    Registered User
    Join Date
    04-13-2009
    Location
    Auckland, New Zealand
    MS-Off Ver
    2010
    Posts
    48

    Re: Maintain range when inserting columns

    file won't upload for some reason, the code of the macro is:

    Please Login or Register  to view this content.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Maintain range when inserting columns

    If you can't attach the file it is probably due to size, try zipping it first
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    04-13-2009
    Location
    Auckland, New Zealand
    MS-Off Ver
    2010
    Posts
    48

    Re: Maintain range when inserting columns

    hmmm, file is only 700kb but have zipped it anyway and seems to have uploaded ok now
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    04-13-2009
    Location
    Auckland, New Zealand
    MS-Off Ver
    2010
    Posts
    48

    Re: Maintain range when inserting columns

    managed to work something out myself

  6. #6
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Maintain range when inserting columns

    file is only 700kb
    LOL, you guys in the Big Smoke think that's trivial? Consider us poor Xtra customers on rural lines

    Quote Originally Posted by dperry View Post
    managed to work something out myself
    Could you please briefly outline what the solution is, for the benefit of people who may have a similar issue and read this.

    cheers

  7. #7
    Registered User
    Join Date
    04-13-2009
    Location
    Auckland, New Zealand
    MS-Off Ver
    2010
    Posts
    48

    Re: Maintain range when inserting columns

    well, it's probably not the smartest way of doing it, but I basically copied the data and pasted it one column to the right and then inserted required data into the first column, this stopped the average funtion from moving across with the original data. Code is:

    Please Login or Register  to view this content.
    if you have any better ideas...
    Last edited by dperry; 10-02-2009 at 12:29 AM. Reason: fixing code tags

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Maintain range when inserting columns

    Please take a few minutes to re-read the forum rules, and then edit your post to add code tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

  9. #9
    Registered User
    Join Date
    04-13-2009
    Location
    Auckland, New Zealand
    MS-Off Ver
    2010
    Posts
    48

    Re: Maintain range when inserting columns

    Hey SHG, I did put the code tags round the code, however it seems that one of the [ is missing at the beginning of the code. Apologies

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Maintain range when inserting columns

    I'll undo the infraction, you fix the code tags.

+ 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