+ Reply to Thread
Results 1 to 14 of 14

Help with ameliorating this macros

  1. #1
    Forum Contributor
    Join Date
    11-05-2012
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    107

    Help with ameliorating this macros

    Test1.xlsmTest1.xlsm

  2. #2
    Forum Contributor
    Join Date
    11-05-2012
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    107

    Re: Help with ameliorating this macros

    Test1.xlsmHello all,

    I have written a vba code and I want to see if anyone can help to ameliorate it. It is a simple code.
    In the attached file you will three colored rows. The macros i have written enable us (after clicking on the blue box) to copy these three lines into specific places on the sheet. Its simple.
    But if we add a row or column they will copied into different places or not at all!

    My question: is there a way (without doing it manually each time) that will let the macros work (i.e copying these 3 lines into specific locations) despite adding rows or columns.

    I dont wont that each time after adding rows or columns to go into the code and make corrections.

    Thank you very much!!!

  3. #3
    Registered User
    Join Date
    03-06-2013
    Location
    House, States
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Help with ameliorating this macros

    Can it be done by naming the cells you want to target? That way they will move when rows or columns are added.

  4. #4
    Forum Contributor
    Join Date
    11-05-2012
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    107

    Re: Help with ameliorating this macros

    Column is potentially not an issue. But what if I add a row?
    I am looking for a way (maybe writing the macros differently) to automate this.

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Help with ameliorating this macros

    Hi Naja

    Please explain what it is you want to do...it's not clear from your Code. Be aware, when adding or deleting rows it's best to start from the bottom rather than from the top.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  6. #6
    Forum Contributor
    Join Date
    11-05-2012
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    107

    Re: Help with ameliorating this macros

    Hello John,

    Ok. I you look at row 7 (yellow). If you click on the blue button it will be copied into rows 10, 11, 24, 38 etc...
    If insert a row for instance above row 5 (maybe to add a title or a pic etc...). The yellow row wont be copied to where i want it be or not at all. To change that i need to do it manually i.e enter the view code and change the range.
    Is there a way (maybe to write the macros differently) so that if i add a row or column, the yellow row will still be copied where it is supposed to be?

    Thank you

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Help with ameliorating this macros

    Hi Naja

    When you add rows your cell references change. Explain what it is you're trying to do...perhaps we can help.
    Before and After is always good...

  8. #8
    Forum Contributor
    Join Date
    11-05-2012
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    107

    Re: Help with ameliorating this macros

    Test2.xlsmHello John,

    In the attached file you will see an after. I added a row above the yellow row (it is now row 8 instead of row 7). If you click on the blue button the yellow row values wont be copied where they are supposed to be (refer to Test1 file i posted in first post).
    I want a way that no matter how many rows or columns i add, the yellow row values will always will be copied where they supposed to be. (i dont want to do it manually).

  9. #9
    Forum Contributor
    Join Date
    11-05-2012
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    107

    Re: Help with ameliorating this macros

    Help anyone????

  10. #10
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Help with ameliorating this macros

    Hi Naja

    Try this
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    11-05-2012
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    107

    Re: Help with ameliorating this macros

    Hello John,

    First of all I want to thank you for your help.
    I copied the code. Ot seems to work once. If if make any modifications the new value wont be corrected.
    Maybe I have pasted wrongly? Or i am making mistakes?

  12. #12
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Help with ameliorating this macros

    Hi Naja

    What kind of modifications are you referring to?

    You REALLY need to explain what you're doing and WHY...

  13. #13
    Forum Contributor
    Join Date
    11-05-2012
    Location
    Montreal
    MS-Off Ver
    Excel 2007
    Posts
    107

    Re: Help with ameliorating this macros

    I have the yellow row with certain values (in row 7). These values must be copied (after clicking on the button) to certain specific rows.
    If I add a row above row 7. The value of the yellow row wont bwe copied were they are supposed to.
    My question: how can we ameliorate my macro so that no matter how many rows or columns i add, the values of the yellow cells will always be copied where are supposed to.

  14. #14
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Help with ameliorating this macros

    Hi Naja

    I believe, based on my understanding of your requirements, the Code does just this
    no matter how many rows or columns i add, the values of the yellow cells will always be copied where are supposed to
    If the Yellow Cells are in Row 7, they'll be copied to Rows 10, 11, 24, 38, 77 and 78. If the Yellow Cells are in Row 8, they'll be copied to Rows 11, 12, 25, 39, 78 and 79. If the Yellow Cells are in Row 9, they'll be copied to Rows 12, 13, 26, 40, 79 and 80.

    So, what am I missing?

+ 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