+ Reply to Thread
Results 1 to 9 of 9

rotate values

  1. #1
    Registered User
    Join Date
    01-18-2015
    Location
    Zurich
    MS-Off Ver
    2016
    Posts
    51

    rotate values

    Hi,

    I want to make a macro that rotates values from a list

    So I write in a list of names, and every time I run the macro it prints a new name from the list in a cell. And it shows the names in order.

    How would I do this?

    Thanks a lot!
    André

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: rotate values

    Q1: Where is the list stored. On a Spreadsheet or in Visual Basic

    Q2: Which Cell is the Name Written in

    Q3: Are the names printed randomly or sequentially.

    Q4: "And it shows the names in order" does that mean List the names sequentially.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    01-18-2015
    Location
    Zurich
    MS-Off Ver
    2016
    Posts
    51

    Re: rotate values

    The list is in excel

    B3:B13 but not all cells will be populated. The first ones will though

    The names are sequential.

    Yes, so if the list is

    John
    Cate
    Lisa

    It first shows John, then deletes John and shows Cate, etc.

    Thanks a lot!

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: rotate values

    Right Click on the sheet name at the bottom of excel and select view code

    Paste this code in the Visual Basic module

    Close the Visual Basic module

    Click on A1.

    Click somewhere else

    Click on A1.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-18-2015
    Location
    Zurich
    MS-Off Ver
    2016
    Posts
    51

    Re: rotate values

    Hi,

    Thanks a lot.

    That works once, but I would like to have it so it is linked to a button and only shows the new value when I click on the button.

    IS that possible?

  6. #6
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: rotate values

    It will work every time.

    but you need to click on A1, click elsewhere and then back on A1.

    It is a selection change macro.

    If you want to use a button then this code is all you need:-


    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    01-18-2015
    Location
    Zurich
    MS-Off Ver
    2016
    Posts
    51

    Re: rotate values

    Hi I tried to get the sub to work, but first it showed me Error 400 and now it says "Object variable or With block variable not set".

    Not sure what is wrong.

    Changed the ranges slightly, maybe you know what I need to fix?

    Best
    André

    --
    Sub rotate()

    Set Last = Range("I5:I15").Find(Range("F3").Value, LookIn:=xlValues, Lookat:=xlWhole)

    Pos = Last.Row

    MyLoop:

    Pos = Pos + 1
    If Pos = 14 Then Pos = 1
    If Cells(Pos, 2) = "" Then GoTo MyLoop

    Range("F3").Value = Cells(Pos, 2).Value

    End Sub
    Last edited by andre1986; 01-12-2016 at 09:50 AM.

  8. #8
    Registered User
    Join Date
    01-18-2015
    Location
    Zurich
    MS-Off Ver
    2016
    Posts
    51

    Re: rotate values

    now excel just crashes

  9. #9
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: rotate values

    Do you have any names in B3 to B13?

+ 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. VBA to Rotate image incrementally based on cell values
    By SteveGilbert in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 04-06-2014, 12:15 PM
  2. rotate bar around circle
    By Stanley91 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-11-2014, 12:35 PM
  3. Rotate x-axis
    By phillyfilly in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 11-20-2013, 06:53 PM
  4. Rotate Values of Four Excel Cells using Macro
    By pagination1 in forum Excel Programming / VBA / Macros
    Replies: 73
    Last Post: 09-10-2013, 05:45 AM
  5. Replies: 4
    Last Post: 05-07-2012, 08:09 PM
  6. Rotate a chart
    By cj1958 in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 03-04-2010, 10:30 PM
  7. [SOLVED] Rotate row
    By MattG in forum Excel General
    Replies: 3
    Last Post: 06-18-2006, 11:15 AM
  8. Can any one help me rotate data
    By Chris Bowden in forum Excel General
    Replies: 1
    Last Post: 02-01-2005, 09:13 AM

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