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 Feb 22nd, 2002, 08:47 PM   #1
Albert
New Member
 
Join Date: Feb 2002
Posts: 3
Default

I have a list of days of the week in a column,with dates in the next column for a whole year.Between sun and mon is a blank row, and I want to move this to go between tues and wed. To many clicks etc for each individual week. Whats the macro I should use to automate this so it does the whole year?
Albert is offline   Reply With Quote
Old Feb 22nd, 2002, 08:55 PM   #2
Juan Pablo González
MrExcel MVP
 
Join Date: Feb 2002
Location: Bogota, Colombia
Posts: 11,927
Default

Just to make sure, can you put some 10 rows of your data and the expected results ?
__________________
Regards,

Juan Pablo González
http://www.juanpg.com
Juan Pablo González is offline   Reply With Quote
Old Feb 22nd, 2002, 09:00 PM   #3
Albert
New Member
 
Join Date: Feb 2002
Posts: 3
Default

Quote:
On 2002-02-22 19:55, Juan Pablo G. wrote:
Just to make sure, can you put some 10 rows of your data and the expected results ?
March Mon 4-Mar 2pm 6pm
Tues 5-Mar 4pm 10pm
Wed 6-Mar 11am 11pm
Thur 7-Mar 12am 9pm
Fri 8-Mar 3pm 8pm
Sat 9-Mar 11am 10pm
Sun 10-Mar 2pm 7pm

Mon 11-Mar 10am 7pm
Tues 12-Mar 1pm 5pm
Wed 13-Mar 2pm 10pm
Thur 14-Mar 4pm 6pm
Fri 15-Mar 3pm 9pm
Sat 16-Mar 4pm 11pm
Sun 17-Mar 1pm 9pm

turn this into:
March Mon 4-Mar 2pm 6pm
Tues 5-Mar 4pm 10pm

Wed 6-Mar 11am 11pm
Thur 7-Mar 12am 9pm
Fri 8-Mar 3pm 8pm
Sat 9-Mar 11am 10pm
Sun 10-Mar 2pm 7pm
Mon 11-Mar 10am 7pm
Tues 12-Mar 1pm 5pm

Wed 13-Mar 2pm 10pm
Thur 14-Mar 4pm 6pm
Albert is offline   Reply With Quote
Old Feb 22nd, 2002, 09:04 PM   #4
Anne Troy
MrExcel MVP
 
Anne Troy's Avatar
 
Join Date: Feb 2002
Location: Allentown, PA
Posts: 2,510
Default

Do this instead:

Delete the contents of both columns, day and date.

In the first cell of dates, type the first date you're using. Format the cell: Format-Cells-Number tab. Choose Date. Choose the one that gives you something like Friday, January 22, 2002 or whatever you like; there are ones that already show the days for you.

Give yourself about 13 cells to start with. Select the last eight cells--a Wednesday through Tuesday and an additional blank cell beyond that. Now click and drag the fill handle (that little square black box at the bottom right-hand corner of your selection) and drag down as far as you want to go. Do NOT allow the cells to become deselected. Hit Copy. Hit Edit-Paste special-Values.

Do you seriously need code now?


__________________
~Anne Troy
Anne Troy is offline   Reply With Quote
Old Feb 22nd, 2002, 09:09 PM   #5
Albert
New Member
 
Join Date: Feb 2002
Posts: 3
Default

sorry I can't do that as there is data in 4 other columns to the right of the days and date columns which has to remain with the correct date.
I have done this before using a macro with 'find, replace' but cannot remember how to do it again, and I dont have the original macro either.
Albert is offline   Reply With Quote
Old Feb 23rd, 2002, 10:30 AM   #6
Guest
 
Posts: n/a
Default

Quote:
On 2002-02-22 20:09, Albert wrote:
sorry I can't do that as there is data in 4 other columns to the right of the days and date columns which has to remain with the correct date.
I have done this before using a macro with 'find, replace' but cannot remember how to do it again, and I dont have the original macro either.

Hi Albert

I/m no Macro expert
but I think the following code will do what you want.

first you should select all the data on your sheet and sort by date order to remove the existing blank rows.

then run this macro
Sub insertrow()

Application.Goto Reference:="R65536C1"
Selection.End(xlUp).Select
lastrow = Selection.Row
Range("A2").Select
For t = 2 To lastrow
If (Left(ActiveCell.Value, 3) = "Tue") Then
ActiveCell.Offset(1, 0).Range("A1").Select
z = ActiveCell.Row
Rows(z & ":" & z).Select
Selection.Insert Shift:=xlDown
ActiveCell.Offset(1, 0).Range("A1").Select
Else
ActiveCell.Offset(1, 0).Range("A1").Select
End If
Next t
End Sub


HTH

  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 06:16 PM.


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