+ Reply to Thread
Results 1 to 16 of 16

need to move a row to another sheet, after a prompt...

  1. #1
    Registered User
    Join Date
    02-07-2014
    Location
    portsmouth
    MS-Off Ver
    Excel 2003/2010
    Posts
    20

    need to move a row to another sheet, after a prompt...

    Hi all,
    well, this is my first post, just really getting to grips with more functionality of excel for more than just number crunching!
    Here is my problem....
    I have a workbook that has several worksheets. The 2 in question are called 'Queries' and 'Archive'.
    The sheet contains information in many rows and columns A to X
    Rows 1-3 are my header and a frozen (rows 4 & 5 are examples and remain at all times, but are not frozen). Column A is frozen and contains a unique identifier.
    Column X contains a drop down menu (datasource on a separate sheet) with options 'In work', 'Closed' or 'Transferred'. The cells in column X also have conditional formatting applied for colour coding.
    What I would like to happen is when a user selects a cell in column X to read 'Closed', a prompt box appears and asks 'would you like to transfer this item to Archive' with buttons to select yes/no. If the user selects no, nothing else happens. If the user selects yes, the entire row (including column A) is moved to the next available row in the 'Archive' sheet. The subsequent blank row is then removed (not sure how to do that either!). I would like this to all happen as soon as 'Closed' is selected, with no need to separately run the macro....I work with some people who won't have a clue if it isn't automatic!
    I already have a workbook macro to make the workbook open on the same page regardless of it's save point, this would make it a very useful tool in my new job (trying to impress the boss!).
    I am using Excel 2010 on a windows machine but the whole thing needs to work on excel 2003.
    I would appreciate an explanation of how any macro is working to further my understanding, if possible.

    Many thanks

    Steve

  2. #2
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Re: need to move a row to another sheet, after a prompt...

    Hi Steve, and a warm welcome to the forums

    If you look at many threads you will see a pattern, the volunteers in the forum almost always react faster if they have a spreadsheets in front of them (well speaking for me that is true at least )
    The spreadsheet sample doesn't need to be huge, just enough to show the inputs and the expected results (remember an example is worth 1000 words... OK something like that)

    Often you will get back not only an explanation but actually working code as well (double bonus)

    Again, welcome to the forums, I am sure you will get assistance

    Jmac
    Last edited by jmac1947; 02-07-2014 at 06:34 AM. Reason: I cannot spell, correcting spelling errors

  3. #3
    Registered User
    Join Date
    02-07-2014
    Location
    portsmouth
    MS-Off Ver
    Excel 2003/2010
    Posts
    20

    Re: need to move a row to another sheet, after a prompt...

    Jmac,
    many thanks for the advice. I have stripped most of the info out of my sheet, but i'll try and upload it.

    Cheers again,

    Steve.

    BTW, not sure if it matters, but I am currently working on a MAC Excel 2011....but main use will, as stated, be on windows 2010/2003 versions.

    Hope the attachment worked

    example.xls

  4. #4
    Registered User
    Join Date
    02-07-2014
    Location
    portsmouth
    MS-Off Ver
    Excel 2003/2010
    Posts
    20

    Re: need to move a row to another sheet, after a prompt...

    Can anyone help me with this please?

  5. #5
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Re: need to move a row to another sheet, after a prompt...

    Steve, sorry been fairly busy for a few days, will try to get to this later today

    Jmac

  6. #6
    Registered User
    Join Date
    02-07-2014
    Location
    portsmouth
    MS-Off Ver
    Excel 2003/2010
    Posts
    20

    Re: need to move a row to another sheet, after a prompt...

    Jmac,
    no problem, any help is much appreciated. been making a little headway by figuring out using 'case' to trigger a msgbox vbyesno type thing but still not there! learning though!!!

    Steve.

  7. #7
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Re: need to move a row to another sheet, after a prompt...

    Hi Steve,

    OK, I have had a very quick look before I dash off to yet another meeting (as you may know, meetings are the practical alternative to actually doing any real work )

    a couple of things spring out as i stepped through the code behind the "Queries" worksheet. (I am assuming you are familiar with stepping through code using F8 and break points etc, if not shout and I will help with a basic understanding)

    The very first test I did was to put a break point in the code at the "If Target.Column = 1 then" code. then I actually went to col X and selected closed from the first row not already closed.

    The value I returned from that expression was 24 (ie Col X) so your code ended as you would expect (24 <> 1). I changed the test to be "Target.Column = 24" and then your code was executed, step one completed.

    Initially I could not see the copied row in the "Archive" worksheet which puzzled me a bit. However closer examination of the Archive worksheet did show me that the entry had indeed been copied into the next row, unfortunately the next available row in that worksheet is row 560 because you have ID values down to row 559 (the code did what you wanted but now where you wanted it to show).

    At this point I am not sure where you want to go. If the values in the Archive worksheet in Col A need to be there in advance of you closing an entry then you need a different way of getting the value for your rng2 variable.

    The question of the message box will be a simple exercise now that it looks like your code actually was very close to doing exactly what you wanted, just need a few more minutes coding to get that done (think case may be an overkill though), will attack after next couple of meetings have passed me by.
    Last edited by jmac1947; 02-10-2014 at 07:02 PM. Reason: spelling typos

    Cheers

    Jmac1947

    1. Please consider clicking on the * Add Reputation if you think this post has helped you
    2. Mark your thread as SOLVED when question is resolved

  8. #8
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Re: need to move a row to another sheet, after a prompt...

    Steve, I snuck in a few more minutes before meeting

    Have a look at this code that should go behind "Queries" tab, just a few minor additions to your existing code

    Please Login or Register  to view this content.
    Hope this is helpful

    Jmac

  9. #9
    Registered User
    Join Date
    02-07-2014
    Location
    portsmouth
    MS-Off Ver
    Excel 2003/2010
    Posts
    20

    Re: need to move a row to another sheet, after a prompt...

    Works a treat.....amazing!
    I don't actually remember how that code got in tree to start with...must've been playing! The code you have written means very little to me, and your explanation is well above my head! Thank you very much though....the boss will be impressed!

  10. #10
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Re: need to move a row to another sheet, after a prompt...

    you are welcome.

    I suggest that you take the time to step through the code with F8 and hopefully if you add some watch variables you will see the code in action, make sure you can see your spreadsheet at the same time as the VB editor to follow what is happening, it is actually reasonably straightforward (as I said the code I found in your spreadsheet was pretty close to working)

    Jmac1947

    1. Click on the * Add Reputation if you think this post has helped you
    2. Mark your thread as SOLVED when question is resolved

  11. #11
    Registered User
    Join Date
    02-07-2014
    Location
    portsmouth
    MS-Off Ver
    Excel 2003/2010
    Posts
    20

    Re: need to move a row to another sheet, after a prompt...

    Right,
    after much pulling of hair and gnashing of teeth, it is almost working now!
    The final (for now) thing thats not working is that i need the 'queries' sheet to sort itself so the queries are in order after being reinstated from the Archive sheet. my code might look a bit messed up, but I have never done anything like this before, so any help is appreciated!
    BTW, this needs to work on Excel 2003.
    Sheet (hopefully) attached!

    Steve Jtracker to be released.xls

  12. #12
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Re: need to move a row to another sheet, after a prompt...

    Hi Steve,

    I just saw your post today, will take a look over the weekend, sorry for the delay (I assume you still have the problem from the last post)

    jmac

  13. #13
    Registered User
    Join Date
    02-07-2014
    Location
    portsmouth
    MS-Off Ver
    Excel 2003/2010
    Posts
    20

    Re: need to move a row to another sheet, after a prompt...

    jmac,
    The issue I have is pretty much as before. I have completely rewritten the spreadsheet and the new one uploaded has been sanctioned by the boss.
    In the new version, the row numbers are not pre-populated on the Archive sheet (no need for them, they are attatched to the relevant query) but are in the Query sheet. I am working on getting rid of theese, but I can't find an easy way to ensure that the next new Query raised has the correct line number (the last query raised my have already been archived, so simply using the next number in sequence on the Qureies sheet my be incorrect).
    This aside....my current isses are:
    when an item is returned to the Queries page, I want the list to sort itsef (not leave the qury at the bottom of the list out of order) by column A from row 4 onwards. I have had this working on excel2010, but it failed in 2003 (needs to work in both).
    On moving queries between sheets, the cells don't appear to be resizing to fit the text in. I have tried to do this by deselecting and reselecting textwrap. it works by hand, but not always in a macro.

    I'm sure I'll find more issues!

    Many thanks for your assistance.

    Steve.

  14. #14
    Registered User
    Join Date
    02-07-2014
    Location
    portsmouth
    MS-Off Ver
    Excel 2003/2010
    Posts
    20

    Re: need to move a row to another sheet, after a prompt...

    UPDATE: I managed to write a macro that adds the next tracker item when you click the button at the top of the page. It considers what's in the archive page as well as in the Queries pages and adds the next line item along with the date. Pretty pleased with myself! lol
    It means the 'sort after move' issue may be a little easier. I have still to test this on Excel 2003. the new sheet is below...

    tracker V9.xls

    This is the one which need amending for the sort after returning to Queries to work (on excel 2003).

    Still working on it myself, but getting nowhere in a massive way!

    Cheers,

    Steve.

  15. #15
    Registered User
    Join Date
    02-07-2014
    Location
    portsmouth
    MS-Off Ver
    Excel 2003/2010
    Posts
    20

    Re: need to move a row to another sheet, after a prompt...

    P.S. - The password for all locked pages/cells is 'jones'.
    just realised, this might help!

  16. #16
    Registered User
    Join Date
    02-07-2014
    Location
    portsmouth
    MS-Off Ver
    Excel 2003/2010
    Posts
    20

    Re: need to move a row to another sheet, after a prompt...

    I think I have sorted the issue.....but I could do with my code cleaning up without breaking it (highly likely if I do it!)
    My sheet is attached below....almost in it's final iteration I think!

    Steves tracker.xls

    Any help will be much appreciated.

    Steve.

+ 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. Replies: 2
    Last Post: 08-27-2013, 05:01 PM
  2. [SOLVED] Move a worksheet with formatting and prompt for save name
    By Cagsy in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-03-2012, 07:54 PM
  3. Delete Sheet Prompt
    By leviathan86 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-08-2012, 09:51 AM
  4. VBA to Prompt for Sheet Name Without Typing
    By Larry.LeBlanc@O in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-17-2009, 04:36 AM
  5. Filter prompt "Fixed Objects wil move"
    By GBpatent in forum Excel General
    Replies: 2
    Last Post: 12-28-2007, 11:45 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