+ Reply to Thread
Results 1 to 17 of 17

Attempting to create a formula/code to have excel automatically move a column over

  1. #1
    Registered User
    Join Date
    06-24-2011
    Location
    Orange County
    MS-Off Ver
    Excel 2003
    Posts
    8

    Attempting to create a formula/code to have excel automatically move a column over

    So first thing first, new to the forum, not so new to excel, but this is my first job using it. I made a spreadsheet that will allow me to input sales of scratchers (based on the number in the stack), and compare it to the previous day's numbers, giving me a total $ amount of sales of scratchers. My question is this, is there a way to have excel move column C to column B, leaving column C clear by changing the date at the bottom of the page? I don't know how clear of an explanation this is but if it's not i can link the file. Any help would be appreciated, I work with some complete morons that cant use a calculator to add/subtract basic numbers so I need to make this sheet as easy to use as possible.

    P.S. - I have attached a before and after file of what i want to happen with this. Thanks again
    Attached Files Attached Files
    Last edited by kharvey; 06-25-2011 at 05:16 PM. Reason: Moderator asked me to

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Don't know if this is possible, need some feedback

    Hello & Welcome to the Board,

    Please take a few minutes to read the Forum Rules about thread titles and then amend your title accordingly.

    After this, try posting a sample workbook with a before and after of what you want to achieve.
    HTH
    Regards, Jeff

  3. #3
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Attempting to create a formula/code to have excel automatically move a column ove

    Just to be clear, in cell B27 you have a date and when you change that date you want the contents of column C moved to column B and column C cleared.

    If this is correct, will the sheet be more than the current 19 rows? If it will I would suggest we move the date to some place else on the spreadsheet just to make life easier.

  4. #4
    Registered User
    Join Date
    06-24-2011
    Location
    Orange County
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Attempting to create a formula/code to have excel automatically move a column ove

    Yeah you have it right, i don't really care where the date is, i could even put it off to the side, it wont be printed, just saved to the computer. It wont be any longer than it is, its a set amount of rows.

  5. #5
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Attempting to create a formula/code to have excel automatically move a column ove

    Give this a try...

    Make sure you tell those moron's you stayed up late building this
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    06-24-2011
    Location
    Orange County
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Attempting to create a formula/code to have excel automatically move a column ove

    Well that definitely works, i had to make 2 minor modifications, changed the last 4 rows to "5" instead of "4", and column C is always greater than column B, so i had to swap the formula around, but it works great, i have no freegin idea how you did that but it works great. Now heres another question, is it possible to make it so that the information thats entered for a particular day is saved, so that if you choose that day on the dropdown menu you made, those numbers come back up? I also noticed that if I change the date twice back to back, it clears the tables, is there any way around that? Thanks again for the help though, this is basically EXACTLY what i needed.

  7. #7
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Attempting to create a formula/code to have excel automatically move a column ove

    Yes it is possible to do just about anything, but, we need to set the ground rules as clearly as possible.

    How do you want the numbers saved? To another sheet so you can just refer to them by date? Do you really need them to come back into the table of data or is the referencing to another sheet fine?

    With the date at the bottom you change, when do you and don't you want the table to change? Whether there is a data validation box with dates or somebody manually enters a date the macro will fire. Do you only want to have the macro fire when they change the date or how?

    This needs to be thought out.

  8. #8
    Registered User
    Join Date
    06-24-2011
    Location
    Orange County
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Attempting to create a formula/code to have excel automatically move a column ove

    Let's see if i can get this out of my head in a way that you can understand (not saying your stupid or anything, just saying its hard to get it from my head onto here and make sense). Lets say, for instance, the first date is today, 6/24/11. Lets say in column B we have the variables T, R, S, and in column C, we have the variables X, Y, Z. (the variables of course being the data that I or someone else enters). Now lets say we change the date to 6/25/11, and the data from column C (X,Y,Z) gets moved to column B, and column C is now clear. Now lets say i enter the new days data and column C, save my file, and want to go look at the data from 6/24/11. Is there a way to be able to select 6/24/11 on the dropdown, and have T,R,S back in column B, and X,Y,Z back in column C? And then be able to go back to 6/25/11 and see the new data that i had entered? I'm assuming this will be a fairly complex macro if it is possible, let me know if anything isnt making sense.

  9. #9
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Attempting to create a formula/code to have excel automatically move a column ove

    Okay let's give this a whirl for starters.

    Everything right now is blank. Enter in Today's totals which we are calling the 24th. Once you enter the totals for today press the transfer button which will take those totals for copy them to sheet tab data.

    Next change the date to the 25th.

    Macro will move today's totals to col B and clear col C

    Now select the 24 again and the totals for the 24th should reappear.

    If you go to the 26th it will not work right, but let's just start with this and see how it goes.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    06-24-2011
    Location
    Orange County
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Attempting to create a formula/code to have excel automatically move a column ove

    I'm messing around with the macro, trying to get it to copy data from both column C and column B, so that if i transfer data on say the 24th, in both column, and go to the 25th, i can go back to the 24th and have both column as they were when i entered them.
    Last edited by kharvey; 06-25-2011 at 03:06 PM.

  11. #11
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Attempting to create a formula/code to have excel automatically move a column ove

    Ok, worked on this a little more and here is what I came up with.

    Notice three tabs:
    1) for sales
    2) for data storage
    3) for data validation

    Right now B23 only has one date >> 24 June 11

    Enter data for today in col C >> select transfer data

    Tomorrow when you open the file the next date will be stored on the data validation tab so now two dates will show in the data validation B23

    Change the closing date to >> 25 June 11

    Data from col C will be moved to col B and col C cleared

    Enter data for today in col C >> select transfer data

    Now if you were to select 24 June 11 the 24 June 11 data would be pulled into col C.

    For the next days all the process should work the same.

    Let me know what you think.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    06-24-2011
    Location
    Orange County
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Attempting to create a formula/code to have excel automatically move a column ove

    How about this, lets simplify it a bit. Forget my coworkers, if they can't figure out how to do this they are obviously in the wrong line of work. Lets take the date out of the equation (no pun intended) completely, and just have a macro that will move column C to column B and clear C for the next days input.

    My boss has been doing all this stuff manually for the past 10-odd years, and I have been doing it manually for the past year i'v been doing this. But I will definitely be referring to your macro and functions as a reference when I make up the other spreadsheets he has been asking me for.

  13. #13
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Attempting to create a formula/code to have excel automatically move a column ove

    Simplified...
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    06-24-2011
    Location
    Orange County
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Attempting to create a formula/code to have excel automatically move a column ove

    Perfect, this will work great, hopefully a few of these....shall we say, idiots, get fired soon and i won't have to cater to them. On a side note, any way to disable the "this file contains macros enable/disable" popup?

  15. #15
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Attempting to create a formula/code to have excel automatically move a column ove

    This is a feature I do not use, but I believe you need to add the file as a trusted location.

    I do not have 2003, but maybe this is a start.

    http://msdn.microsoft.com/en-us/libr...ffice.11).aspx

    One method I use quite often is to force macros to be enabled.

    In other words, when the file opens one sheet will show in-which you put a message, "macros must be enabled to use this file".

    Once the macro is enabled the sheet will open properly.

  16. #16
    Registered User
    Join Date
    06-24-2011
    Location
    Orange County
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Attempting to create a formula/code to have excel automatically move a column ove

    The trusted source thing worked. The sheet was working properly, it was just giving me that prompt EVERY time i opened the file, and was getting kind of annoying. But its all working peachy now, thanks again!

  17. #17
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Attempting to create a formula/code to have excel automatically move a column ove

    You're welcome...glad it has all worked out for you

    If you are satisfied with the answer provided, please don’t forget to mark the thread as solved.

    How to mark a thread Solved
    Go to the first post
    Select
    -- Edit
    -- Go Advanced
    -- Below the word Title you will see a dropdown with the word No prefix
    -- Update to Solved
    -- Save

+ 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