MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Apr 1st, 2002, 08:53 AM   #1
dan2
Board Regular
 
Join Date: Mar 2002
Posts: 60
Default

Here is a hard one (I think!) to challenge someone.

I have a table of quantity of ppl by half hour of a day as in:

11:00 3
11:30 5
12:00 4
12:30 6
and so on.....

and need to show it pictorally (not as a graph!) as follows:

11:00..11....11....11
11:30..11.5..11.5..11.5..11.5..11.5
12:00..12....12....12....12
12:30..12.5..12.5..12.5..12.5..12.5..12.5
and so on.......

This does make it look like a bar graph I know.
This part I have managed to do with IF statements and some VBA, it is the next stage that at the moment users are having to do manually and it would be alot quicker and easier if I could find a way to automate the last step or even miss out the above step and go straight to the last below

11:00..11....11....11
11.30..11.5..11.5..11.5..11.5..11.5
12.00........12....12....12....12
12.30........12.5..12.5..12.5..12.5..12.5..12.5
and so on......

Im not sure how the above will look on this message or if I have made any sense so if you can't understand it and you think you might be able to help I can e-mail an example to you.

Thanks in advance

Dan.
dan2 is offline   Reply With Quote
Old Apr 1st, 2002, 09:03 AM   #2
Al Chara
MrExcel MVP
 
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
Default

What exactly do you want to happen during this step?
Al Chara is offline   Reply With Quote
Old Apr 1st, 2002, 09:07 AM   #3
dan2
Board Regular
 
Join Date: Mar 2002
Posts: 60
Default

its very hard to explain but basically the bars in the bar graph style pictoralisation of the table are slid along to make a schedule of shifts for staff.

It is very hard to explain in words so I can send an example on a worksheet.
dan2 is offline   Reply With Quote
Old Apr 1st, 2002, 09:12 AM   #4
Al Chara
MrExcel MVP
 
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
Default

I get it, you want the time slots to lineup in their respective time location underneath each other. What are your time limits?

[ This Message was edited by: Al Chara on 2002-04-01 08:13 ]
Al Chara is offline   Reply With Quote
Old Apr 1st, 2002, 09:29 AM   #5
dan2
Board Regular
 
Join Date: Mar 2002
Posts: 60
Default

Al

Ok Ill try and describe the drag and drop process in words (This will be fun!)

Using the figures in the first post, and understanding that the table has col A as time and Col B as qty of ppl, so the amount of ppl the user can have working for each half hour of the day.

The second part basically makes a bar graph of the table with each row being a half hour segment of the day and each col being a amount of ppl.

The finished product needs to be a schedule with each row being time as before and each col will have a name put to it so that it shows that persons shift to work below. The drag and drop process is as follows:

The first row with ppl in it stays where it is, then as long as the next row has the same or more people in it then it also stays where it is. If the next row has less ppl in it then it has to be dragged to the right so that the right hand end of the row is in line with the right hand end of row above. Then after one of the rows has moved then 1 of 2 actions is applied to each row there after either as above if it is shorter than the row above or if it is longer than the row above then it is dragged to the right until the left hand end if level with the left hand end of the row above. and so on until all the rows are moved.

The time goes from 8:00 till 03:00 so there are 39 rows in total.

After reading the above Im not sure if this helps at all to explain what I am trying to do, but I cant think of any better way of putting it into words.

Dan.
dan2 is offline   Reply With Quote
Old Apr 1st, 2002, 11:40 AM   #6
dan2
Board Regular
 
Join Date: Mar 2002
Posts: 60
Default

Anyone up for the challenge?
dan2 is offline   Reply With Quote
Old Apr 1st, 2002, 12:45 PM   #7
Fryer Tuck
Board Regular
 
Join Date: Mar 2002
Posts: 64
Default

I set up a test, with times starting at cell A4, and ppl starting in cell B4. If you start on a different line, change the value of "Rwr". Note that with the following, it is important that the cell above the first ppl (in this case that would be cell B3) be left blank or equal to 0. The "bar graph" started in cell D. You could change it to cell "C" by changing the value of Strt to "2", but you can not start it in cell "B".

Run the following in a macro once you have the times and ppl amounts.

Sub Macro1()
Dim Strt, Fnsh, Rwr, FilCnt As Integer
Strt = 3
Rwr = 4
Do While Range("A" & Rwr) <> Empty
If Range("B" & Rwr) > Range("B" & Rwr - 1) Then
Fnsh = Strt + Range("B" & Rwr) - 1
End If
If Range("B" & Rwr) < Range("B" & Rwr - 1) Then
Strt = Fnsh - Range("B" & Rwr) + 1
End If
For FilCnt = Strt To Fnsh
Range("A" & Rwr).Offset(, FilCnt) = Range("B" & Rwr)
Next
Rwr = Rwr + 1
Loop
End Sub

If you run this daily on the same sheet, then you will want to add code that gets rid of the prior day's graph. Also, if you want to get fancy, you can have the cells color or other fancy stuff in the "FilCnt" loop.

Happy scheduling

Fryer Tuck is offline   Reply With Quote
Old Apr 1st, 2002, 01:32 PM   #8
dan2
Board Regular
 
Join Date: Mar 2002
Posts: 60
Default

Fryer Tuck

Thanks alot that has been bugging me for sooooooo long, and has cut a large amount of code out of the modules.

Thanks again

Dan.
dan2 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 10:31 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes