+ Reply to Thread
Results 1 to 17 of 17

Reverse Data Within Cell By Date

  1. #1
    Registered User
    Join Date
    01-09-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    10

    Reverse Data Within Cell By Date

    Greetings,

    I have attached an Excel spreadsheet and I will apologize now if I lose you. This spreadsheet contains two entries:

    "SwapIt" works great but will only reverse the most current date entry and list it first in the cell and the remaining date entries will remain in oldest to latest dates.

    "ReverseDates" works great but errors out with <subscript out of range> when a manual date is entered in the notes (see system created format).

    System created format; the entries within a cell will always be - MM/DD/YYYY_tt:tt:tt_AM(PM)_username (this varies) followed by the notes entered by user. So in a nutshell, the system will generate all the following but from oldest dates to latest dates toward the bottom of the cell. I would like to achieve the reverse order, latest entries to oldest entries.

    Again my apologies for rambling.

    Regards!!
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    01-21-2005
    Location
    Colorado
    MS-Off Ver
    2000,2003,2007
    Posts
    481
    Did you look at why your code was throwing the error?
    When I tested it the problem was in cell H74.
    As part of the note the text has the date,time,username. But then in the text of the note there is another partial date "implementaion 1/09".
    It looks like your check
    Please Login or Register  to view this content.
    is improperly identifying this as a date and then hanging up on the
    Please Login or Register  to view this content.
    line.

    Perhaps you could make the
    Please Login or Register  to view this content.
    more particular and have it check SplitCell(i) for the Date,time stamp that starts each new entry.

    HTH

  3. #3
    Registered User
    Join Date
    01-09-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    10
    Thank you HTH. However, I kind of inherited this form and was looking for some expertise as I am new to vb...

    I attempted adding your code and it still fails. I believe I am doing something wrong.

    Thanks again!!

  4. #4
    Forum Contributor
    Join Date
    01-21-2005
    Location
    Colorado
    MS-Off Ver
    2000,2003,2007
    Posts
    481
    I didn't give you any code to add to your project.

    I simply stepped through your code and identified where it was giving you the error. try using F8 and the debugger to identify where your code is giving you trouble.

    My suggestion was to either eliminate any text that is identified as a date by the line.
    Please Login or Register  to view this content.
    Or to modify that line to discriminate between a real date and a date in the body of the text.

  5. #5
    Forum Contributor
    Join Date
    01-09-2009
    Location
    Cedar Hill, Tx
    MS-Off Ver
    Excel 2003
    Posts
    200
    I can't help with your request but can maybe give you a direction as an old database guy. If you can strip the DTG and userName data from the cell and put them into their own cell on the record, you would have a lot more flexibility with data sort, filtering, etc. and it should be easier, too. ;-> FWIW.

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello nobi,

    I have added 2 new macro to the attached workbook. The code code for these appears below. This will reverse the data order of each log entry in the cell, bold the date, and add a vertical tab to each log entry. You can easily change where the log entries are located. The worksheet name and starting cell address are located in the macro ReverseAllDates and are marked in red.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross
    Attached Files Attached Files
    Last edited by Leith Ross; 01-10-2009 at 08:20 PM. Reason: Added code line to free regular expression in memory

  7. #7
    Registered User
    Join Date
    01-09-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    10
    Hi Leith,

    You are my hero!! Works great as desired. A million thanks for the assistance. Is it possible to bold the user name as well?

    Thanks again!!!!!!
    Last edited by nobi; 01-12-2009 at 07:31 PM.

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello nobi,

    I'll see if I can make the user name bold as well.

    Sincerely,
    Leith Ross

  9. #9
    Registered User
    Join Date
    01-09-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    10
    Thanks Leith!! If it helps any, the user name will always be uppercase. Then all notes are always entered as proper sentence case.

  10. #10
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello nobi,

    It looks like the user name also follows the time stamp with a space between them. I'm hoping the are no user names with spaces in them.

    Sincerely,
    Leith Ross

  11. #11
    Registered User
    Join Date
    01-09-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    10
    Hi Leith,

    Its the date/time stamp with "AM" OR "PM", space and then the user name with no users ever having a space in within the user name.

    Thank again for your efforts. Its greatly appreciated.
    Last edited by nobi; 01-13-2009 at 02:26 PM.

  12. #12
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello nobi,

    Got it to work. Here is the revised code which is already been added in the attached workbook.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    01-09-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    10
    Hi Leith,

    Need I say more... thank you for your great work and assistance.

    It is appreciated!!!

    Regards!!!!

  14. #14
    Registered User
    Join Date
    01-09-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    10
    Hi Leith,

    I hope Im not pushing my luck, but do you know if I can restrict (delete) to only show 4 date/user entries. The work long is getting kind of long with all the notes entered, so I wanted to see the 4 most recent entries.

    Thanks again!!

  15. #15
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello nobi,

    I have added an If...Then to limit the maximum entries to 4. This will of courser permanently change the data on the sheet. You will lose the other entries above 4 for that cell.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

  16. #16
    Registered User
    Join Date
    01-09-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    10
    Hi Leith,

    Wow... thanks again!!!! All your help was/ is greatly appreciated!!!! I owe you lunch.

    Regards!!!

  17. #17
    Registered User
    Join Date
    01-09-2009
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    10
    Hi Leith,

    I just wanted to mention one more thing if I may... the >4 is not saving the most recent entries. I moved the code and then it doesnt work?

    Your assistance is requested one more time if I may.

    Thanks!!!!!!!!!!!!!

+ 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