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 May 16th, 2002, 04:51 AM   #1
SubZero
New Member
 
Join Date: May 2002
Posts: 8
Default

Hi, I have scanned some details into a worksheet, but I need to rearrange the data and clean it. The data is company name, address and tel / fax and email. When imported each text/number string is in its own cell. eg format

company name limited
3 the orchard, sudbury tel
05555 555555 london, UK, email
someone@someosn.com

(This format is repeated many times, possibly data is in a different order but although row lengths may change, there is always data at the 1st cell of the row, afterwards there is blank row before the next record.)

What I want to do is get the tel number next to the company name on one row (company name is always the only data in row 1 of the record), so i need a macro to find the word "tel", then if there is anything in the next cell copy it, and paste it next to the company name, 1 cell on. If there is no data in the cell after "tel" we need to move to the next row and copy the 1st cell, then paste it above. I also need to do this for the second part of the phone number. (TEL 05555 55555 will always appear after each other but may be split over 2 rows) Once done I should have:
Company name Limited 05555 555555
The rest of the data on that record can be deleted, now proceed to the next record, do the same and loop...
I hope this is clear? and look forward to your help.
SubZero is offline   Reply With Quote
Old May 16th, 2002, 07:32 AM   #2
Dexter
Board Regular
 
Join Date: Apr 2002
Location: St. Louis
Posts: 71
Default

Subzero,

I have worked through similar problems. Is your imported data in a predictable format. What does the data look like if there is no telephone number?

Dexter
St. Louis
Dexter is offline   Reply With Quote
Old May 16th, 2002, 07:39 AM   #3
SubZero
New Member
 
Join Date: May 2002
Posts: 8
Default

There is always a phone number, 2 eg's as copied from the page are:

ULMKE (BIR)
Birmingham Road, Saltisford, Warwick,
CV34 4TT, Tel 01926 496145 Fax 01926
415441

ULMKE (COV)
19 Coventry Road, Nr Ullenhall, Tel
02476 4545454 Fax 02476 87789787

As you can see the Name is always on one row on its own, the tel number is always there but can be spread on 2 rows. In excel I have made all data into a table using spaces, so that each word or series of numbers is in it's own cell, thats why tel is 1 cell, 01246 is 1 cell & 5454545 is another cell.
SubZero is offline   Reply With Quote
Old May 16th, 2002, 09:51 AM   #4
Dexter
Board Regular
 
Join Date: Apr 2002
Location: St. Louis
Posts: 71
Default

SubZero,

Although I do not understand your situation completely, here is some code that I use to so some similar data manipulation on an imported text file. Maybe it will give you some ideas.

Dexter

Sub AddPINS()

'This routine copies the PINS number to each row of data

Sheets("648f710").Select
Range("C7").Select

For N = 1 To 300 'Upper number in loop represents number of plans in file.
ActiveCell.Offset(1, 0).Select
ActiveCell.Offset(0, -2).Select
If ActiveCell.Value = "" Then Exit For
Selection.Copy
ActiveCell.Offset(-1, 0).Select
ActiveSheet.Paste
ActiveCell.Offset(2, 0).Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveCell.Offset(2, 2).Select

Next N
End Sub
Sub AddLineLabels()

'This routine copies the range named "transaction_labels" to each set of insurance data.
'The transaction labels are: CHG, PMT, ADJ

Range("Transaction_Labels").Copy
Sheets("648f710").Select
Range("B7").Select

For L = 1 To 600 'Upper number in loop represents number of plans in file.

If ActiveCell.Offset(0, -1) = "" Then Exit For
ActiveSheet.Paste
ActiveCell.Offset(4, 0).Select

Next L

Range("A1").Select
Application.CutCopyMode = False
End Sub
Dexter 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 05:44 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