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 Mar 15th, 2002, 04:11 AM   #1
clares
Board Regular
 
Join Date: Mar 2002
Location: Portsmouth.UK
Posts: 543
Default

I'm sure there must be someone that can help me. I posted a previous note but felt I needed to be more specific. My question is that I want to select a product from a range that I have exported from another system and I want to be able to print a set of labels, for example sometimes I want to print 5 labels containing the same text and other times I want to print 24 say. That I have no problem with. My problem is that I want to be able, by using a macro, to fill a range (row) with the same data. It's this that is used for exporting into word for labels i.e.
row1= AA4567 Pens
row2= AA4567 Pens
row3= AA4567 Pens
In the above example I will get three labels, but only want to enter data in row1, the macro will copy to the amount that I ask it to!

Can anyone suggest any ideas! Will be much appreciated
clares is offline   Reply With Quote
Old Mar 15th, 2002, 04:35 AM   #2
Dave Hawley
Banned
 
Join Date: Feb 2002
Posts: 1,582
Default

Hi clares

No too surte I have understood you but here 3 ways, 2 are that are static the other 1 is incremeting.



Sub DoThePenThing1()
Sheet1.Range("A2:A500") = "AA4567"
End Sub

Sub DoThePenThing2()
Sheet1.Range("A2:A500") = Sheet1.Range("A1")
End Sub

Sub DoThePenThing3()
Sheet1.Range("A2").AutoFill Destination:=Sheet1.Range("A2", Sheet1.Range("A500"))
End Sub

_________________
Kind Regards
Dave Hawley
OzGrid Business Applications
Microsoft Excel/VBA Training


[ This Message was edited by: Dave Hawley on 2002-03-15 03:36 ]
Dave Hawley is offline   Reply With Quote
Old Mar 15th, 2002, 04:58 AM   #3
clares
Board Regular
 
Join Date: Mar 2002
Location: Portsmouth.UK
Posts: 543
Default

Thanks for that Dave, but using the last option I think will fill the range between A2 and A500 with the data I want, but sometimes I only want to fill to A4, how can I allow it to accept an input from the user?, then automactically fill the range?

Does that make sense?
clares is offline   Reply With Quote
Old Mar 15th, 2002, 04:59 AM   #4
Guest
 
Posts: n/a
Default

If Ivan's suggestions are not what you're looking for, perhaps this will help.

I have assumed that your imported product number occupies one cell only. If this is not the case, post again.

In any event, try the following. First select a cell containing the product number required and then run the code. It should enter the product number in the number of rows in column A specified by the input box.

Dim nbr As Integer
If Selection.Cells.Count <> 1 Then
MsgBox "You must select one cell only"
Exit Sub
End If
nbr = Application.InputBox("Enter how many labels are required", Type:=1)
If nbr = False Then Exit Sub
Columns(1).ClearContents
Range("A1:A" & nbr) = Selection
  Reply With Quote
Old Mar 15th, 2002, 05:06 AM   #5
Dave Hawley
Banned
 
Join Date: Feb 2002
Posts: 1,582
Default

Sure can, try this

Sub DoiT()
Dim rStopRange As Range
On Error Resume Next
Set rStopRange = Application.InputBox(Prompt:="Select the cell to stop at", Type:=8)

If rStopRange Is Nothing Then End
Range("A2").AutoFill Destination:=Range("A2", rStopRange)
End
End Sub
Dave Hawley is offline   Reply With Quote
Old Mar 15th, 2002, 05:37 AM   #6
clares
Board Regular
 
Join Date: Mar 2002
Location: Portsmouth.UK
Posts: 543
Default

These suggestions are really helpful. Thank you all for the responses. I do beleive I am able to make progress. If I have further queries as the small project moves on, I will post
clares is offline   Reply With Quote
Old Mar 15th, 2002, 10:01 AM   #7
clares
Board Regular
 
Join Date: Mar 2002
Location: Portsmouth.UK
Posts: 543
Default




[ This Message was edited by: clares on 2002-03-15 09:02 ]
clares 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 06:53 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