+ Reply to Thread
Results 1 to 5 of 5

Rotate List of names bottom to top Repeat without condition with option to set a condition

  1. #1
    Registered User
    Join Date
    12-01-2017
    Location
    New Jersey
    MS-Off Ver
    2016
    Posts
    63

    Rotate List of names bottom to top Repeat without condition with option to set a condition

    Hello,
    I have a list of employees in Column A with a manual entry of % of work for the day in Column B. As an example Row 1 Column A&B should move together. There are headers in Column A&B with 10 employees currently. The current range is A1:B11. I would like to rotate the names in columnA plus any entry in column B bottom to top with the top moving down one row. I would like to repeat this each time the macro is selected, but add an option that may allow me to set a condition, such as only once a day if i need to in the future. Until we see how the workload is dispersed I am undecided on adding in the condition. I did try adapting code I found online as i tried to work through this, but it fails at "NewListValue(Placement(Counter), 1) = _" with subscript out of range. The code below was setup only for Column A, but did not work. I do still need A&B to move together. The code below was just a start to the solution. There may be better ways to appraoch this.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: Rotate List of names bottom to top Repeat without condition with option to set a condi


    Hi !

    With data from a worksheet no needs any loop …

  3. #3
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Rotate List of names bottom to top Repeat without condition with option to set a condi

    You could use event code like that below to rotate the data in columns A and B beginning at row 2. If you want to restrict the rotation to once a day, then remove the apostrophe on line 2 of the code.
    Please Login or Register  to view this content.
    The code would be placed in the sheet code module for the sheet where the rotation is desired.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  4. #4
    Registered User
    Join Date
    12-01-2017
    Location
    New Jersey
    MS-Off Ver
    2016
    Posts
    63

    Re: Rotate List of names bottom to top Repeat without condition with option to set a condi

    Hi JL GWhiz,
    The code does work on the sheet. I have adjacent formulas that all get corrupted when the rotation occurs. I was able to adjust the date down a cell that eliminated it writing over another cell, but when the Cut or Shift down occurs, the formulas in adjacent cells change. Even though they are absolute they change. I am not familiar with the reize command. I actually have 4 of these that I need to rotate on the same sheet. Is there an alternate way to run this. Possibly in a module compared to sheet code?
    Schedule 1 Columns A&B rotate
    Schedule2 Columns G&H rotate
    Schedule 3 Columns M&N rotate
    Schedule 4 Columns S&T rotate
    All exist in Rows 2-11
    I can repeat the code with the new columns identified and I was able to get the first 2 to rotate, but both had the formula error then
    Thank You in Advance

  5. #5
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Rotate List of names bottom to top Repeat without condition with option to set a condi

    Quote Originally Posted by spyac View Post
    Hi JL GWhiz,
    The code does work on the sheet. I have adjacent formulas that all get corrupted when the rotation occurs. I was able to adjust the date down a cell that eliminated it writing over another cell, but when the Cut or Shift down occurs, the formulas in adjacent cells change. Even though they are absolute they change. I am not familiar with the reize command. I actually have 4 of these that I need to rotate on the same sheet. Is there an alternate way to run this. Possibly in a module compared to sheet code?
    Schedule 1 Columns A&B rotate
    Schedule2 Columns G&H rotate
    Schedule 3 Columns M&N rotate
    Schedule 4 Columns S&T rotate
    All exist in Rows 2-11
    I can repeat the code with the new columns identified and I was able to get the first 2 to rotate, but both had the formula error then
    Thank You in Advance
    You did not mention the formulas and their locations in the OP. If any of the cells being rotated are dependent or precedent to the formulas, Excel will attempt to keep the reference to tho the original cell, wherever it moves. Does not matter where the code runs from.

    The resize method allows the parameters of an anchor cell or range to be resized into a range of cells using row and column parameters, e.g. Resize(2, 6) would be 2 rows and six columns starting with the anchor cell at upper left. It can save a lot of space from writing out the Range and Cells syntax.
    Last edited by JLGWhiz; 07-05-2018 at 08:06 PM.

+ 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. Formula to rotate a list of names
    By cmac1114 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-26-2019, 04:15 PM
  2. Repeat Macro until condition is met
    By cmb80 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-14-2015, 07:56 AM
  3. Replies: 2
    Last Post: 06-29-2014, 10:11 AM
  4. Replies: 4
    Last Post: 05-17-2014, 07:07 AM
  5. Replies: 1
    Last Post: 06-19-2013, 12:49 AM
  6. Sum until a condition is met and repeat for a range
    By natattack in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-13-2012, 06:30 PM
  7. Replies: 2
    Last Post: 07-27-2009, 09:29 AM

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