PDA

View Full Version : Reformat Table with Times



Rishek
06-28-2017, 11:03 AM
A lot of posts by me today, but I actually got another macro I was playing around with to work halfway and so I'm feeling ambitious. This is a repost from here (http://www.vbaexpress.com/forum/showthread.php?59824-Formating), but I don't think I did a very good job of explaining the problem, so I thought I'd try again.

This document, which is a rehearsal schedule (19622) contains the table I'm trying to edit with an edited version how I'd like it to come out. The other rows/ tables are blank, but they'd typically be filled with data.

I have three/four discrete tasks I want to accomplish.

1)
Each rehearsal is listed with a start and end time. Anytime someone should arrive later during a rehearsal, a time is listed as follows:



10:00am - 1:00pm
Rehearsal Name
Name1, Name2
Location


12:00pm
ADD
Name3




ADD is the term we use to indicated that someone is being added to the rehearsal at the time listed. I need to be able to change the first column to show an end time like so:




10:00am - 1:00pm
Rehearsal Name
Name1, Name2
Location


12:00pm - 1:00pm
ADD
Name3





2)
Similarly, we let people out of various rehearsals at certain times as shown here:




10:00am - 1:00pm
Rehearsal Name
Name1, Name2
Location


12:00pm
REL
Name2




REL being our abbreviation for this. I need to add the start time to the first column and remove the person's name from colum three of the initial row so that is doesn't get counted when I run a macro that checks for double booking. Result should be this:





10:00am - 1:00pm
Rehearsal Name
Name1
Location


10:00am - 12:00pm
REL
Name2




3)

The real fun is when we add and release people at the same time, like so:





10:00am - 1:00pm
Rehearsal Name
Name1, Name2
Location


12:00pm
ADD/REL
ADD: Name3; REL: Name 2




Then I need to split the second row into two so that I have an entry for the ADD and the REL and eliminate the name from the initial call, like so:




10:00am - 1:00pm
Rehearsal Name
Name1
Location


10:00 - 12:00pm
REL
Name 2



12:00 - 1:00pm
ADD
Name 3





In none of the above examples is it important what happens in the second column. I adjusted it in the third example to make clear what was happening.

4) A further complication: we sometimes release someone that we have added:





10:00am - 1:00pm
Rehearsal Name
Name1, Name2
Location


12:00pm
ADD
Name3



12:30pm
REL
Name3





Assistance on any of these problems appreciated and apologies for filling the forum today.