Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Printing labels from excel worksheet
I'm sure this is a very simple question but it's still beyond me - so
I'd be grateful for any help anyne can offer. I have an Excel spreadsheet with several thousand records of computer parts. Each record has a unique identifier of 5 or 6 alphanumeric characters eg 3T453. There are four other fields which describe the item. For example, a line looks like this:- 3T453 Compaq Deskpro 410 23/12/2004 12 What I need is a method to search through the database by typing in the identifier ('3T453') and then when the appropriate record is found, to lift out the five bits of information and print them on a label in a much larger font eg 3T453 Compaq Deskpro 410 23/12/2004 12 Then I'd like to be able to input another identifier - and so on. I can record a macro to do most of this this in a rather amateur and static way by first using 'Edit/Find' but I don't know how to write the code to invoke a macro that will do the whole lot more seamlessly. I hope this make sense and that someone can tell me how to do it! Many thanks for any help. PS: I would have looked through the existing posts, but as there are over 350 000 of them, I just don't have the time, as I will be retiring in the next couple of years. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Printing labels from excel worksheet
Sub PrintLabel()
Dim rng as Range, rng1 as Range Dim ans as String with worksheets("Data") set rng = .Range(.Cells(2,1),.Cells(2,1).End(xldown)) end with ans = InputBox("enter unique identifier") set rng1 = rng.Find(What:=ans, _ After:=rng(rng.count), _ LookIn:=xlFormulas, _ LookAt:=xlWhole, _ SearchOrder:=xlByRows, _ SearchDirection:=xlNext, _ MatchCase:=False) if not rng1 is nothing then rng1.Resize(1,4).Copy With worksheets("Printout") .Range("A1").PasteSpecial xlValues, Transpose:=True .Range("A1:A5").Printout .Range("A1:A5").ClearContents End with End if End Sub have the printout range A1:A5 on sheet Printout preformatted for the font and other format settings you want. -- Regards, Tom Ogilvy "Emlyn Whitley" wrote in message ... I'm sure this is a very simple question but it's still beyond me - so I'd be grateful for any help anyne can offer. I have an Excel spreadsheet with several thousand records of computer parts. Each record has a unique identifier of 5 or 6 alphanumeric characters eg 3T453. There are four other fields which describe the item. For example, a line looks like this:- 3T453 Compaq Deskpro 410 23/12/2004 12 What I need is a method to search through the database by typing in the identifier ('3T453') and then when the appropriate record is found, to lift out the five bits of information and print them on a label in a much larger font eg 3T453 Compaq Deskpro 410 23/12/2004 12 Then I'd like to be able to input another identifier - and so on. I can record a macro to do most of this this in a rather amateur and static way by first using 'Edit/Find' but I don't know how to write the code to invoke a macro that will do the whole lot more seamlessly. I hope this make sense and that someone can tell me how to do it! Many thanks for any help. PS: I would have looked through the existing posts, but as there are over 350 000 of them, I just don't have the time, as I will be retiring in the next couple of years. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Printing labels from excel worksheet | Excel Programming | |||
PRINTING LABELS FROM EXCELL WORKSHEET | New Users to Excel | |||
Printing labels from excel | Excel Discussion (Misc queries) | |||
printing labels through excel | Excel Discussion (Misc queries) | |||
Printing Labels using Excel | Excel Programming |