+ Reply to Thread
Results 1 to 7 of 7

Help with macro that can input data while moving cells without compromising formulas

  1. #1
    Registered User
    Join Date
    04-28-2017
    Location
    United States
    MS-Off Ver
    2007
    Posts
    10

    Help with macro that can input data while moving cells without compromising formulas

    Hello,

    In the attachment, I have 4 blocks in sheetA. Let's say in the first and third blocks, we want to move the bottom right most 4 cells down and over right one cell. Then go into our second sheet and input the first line of data in rows 23 and 73. (Similar occurrence with blocks 2 and 4 except the bottom right most cells that should be moved have 2 cells). What is a good way to put this into a macro? I have a third sheet that has the desired outcome that doesn't compromise the formulas.

    I tried recording the macro, but this needs to be done every month; and cell ranges are changing after every month. Therefore, a recorded macro would need to be changed every month due to the cells constantly changing each month.

    Thank you
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Help with macro that can input data while moving cells without compromising formulas

    "Let's say" - That indicates to me that you don't know how many cells you want to shift in each block until run time. How would you like to prompt for these values? I could give you a table where you have block number and number of cells to shift. You would have to fill this out before running the macro.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    04-28-2017
    Location
    United States
    MS-Off Ver
    2007
    Posts
    10

    Re: Help with macro that can input data while moving cells without compromising formulas

    Well in my post I did indicate the cells that need to be moved and I even have my excel document with the data, the data that will be overwritten each month and the desired result as an attachment. The problem is that the amount of cells will increase with each month as more months are being added. ie in October, youll have months January through October. In November, youll have months January through November. in December, youll have the entire year. then in January, you'll have the entire previous year in addition to that January being added.

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Help with macro that can input data while moving cells without compromising formulas

    So the amount of cells is "hard coded" to either 2 or 4 depending on the group. There seems to be a disconnect between the source and the desired results. If I am taking the last two rows, shifting them down one and right one and pasting them, I have the last row "dangling" on an empty row.

    Is there a reason the new data gets added two rows before the end?

  5. #5
    Registered User
    Join Date
    04-28-2017
    Location
    United States
    MS-Off Ver
    2007
    Posts
    10

    Re: Help with macro that can input data while moving cells without compromising formulas

    I think you may be reading the post incorrectly. Never does it say things are hard coded to either 2 or 4 depending on the group. The reason for the new monthly data is to create a triangle of sorts in each block of cells. So the desired result should have dangling rows to create that desired triangle within the yellow parts of the blocks.

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Help with macro that can input data while moving cells without compromising formulas

    You are correct, I am not getting it. How do I determine if I copy and move a block of two or four cells?

  7. #7
    Registered User
    Join Date
    04-28-2017
    Location
    United States
    MS-Off Ver
    2007
    Posts
    10

    Re: Help with macro that can input data while moving cells without compromising formulas

    Ok, the "block of two or four cells" refers to the collection of cells in the second and fourth blocks. I have four total in the worksheet. cell block 1 cell block 2 cell block 3 and cell block 4.

    As monthly data gets overwritten (A simple copy and paste by me) as the months progress, more months will be extended outward. Meaning more columns will be added (by me) to each of the rows in the second worksheet.

    The goal here is to have this automated (because my real file contains many more blocks of cells and much more data) with macros without compromising the formulas (formulas "WILL BE" in blue cells in the first worksheet and formulas are also in purple).

    In the third worksheet, I have a box over which cells need to be moved by moving them down one cell and over one cell as the monthly data comes in. the purple will need to be moved down to make room for the data for that given month.

+ 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] Allowing Users to Input Data into Cells Containing Formulas without Deleting the Formula
    By MayBTheresHope in forum Excel Formulas & Functions
    Replies: 25
    Last Post: 10-29-2018, 07:43 PM
  2. Filtering data flexibility without compromising various data averages
    By Sam2000 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-20-2012, 08:20 AM
  3. [SOLVED] Formula / macro needed for merging cells and moving related data
    By Virtuallynne in forum Excel General
    Replies: 4
    Last Post: 05-03-2012, 06:48 AM
  4. Macro for Moving, Combining, and Manipulating Data Cells
    By RogerDunham in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-01-2011, 05:37 PM
  5. Moving cells with formulas
    By martynduerden in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-23-2009, 04:30 PM
  6. Moving data depending on input
    By Server2008R2 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-07-2009, 05:56 PM

Tags for this Thread

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