Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I appreciate any insights you experts can give to me.
I want to use multiple command buttons on a single worksheet to print associated subsets (ranges) of worksheet data that may vary. In each case I would like to search the worksheet for "planted" text strings (that will indicate the upper-left and lower-right limits of a desired print range) and return those locations into the ActiveSheet.PageSetup.PrintArea = "loc upper-left:loc lower-right" function. Can this be accomplished? Thanks -- Russ |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
A couple of ideas come to mind:
1. Create dynamic ranges, say MyRange1,...MyRange2 whatever: InsertNameDefine Enter MyRange1 in the Name box. Below in the RefersTo box enter (with the equal sign) =Offset(Sheet1!$B$2,0,0,CountA(Sheet1!$B$2:$B$1000 ),1) The 1st argument is the upper left cell of you range. The 1000 is beyond the max rows you will ever expect you will need. The last 1 is the number of columns in your range - its width. As you add/delete data to the lower end of your range or insert rows, the range definition changes to accomodate the data Then you can simply print this range with: ActiveSheet.PageSetup.PrintArea = MyRange1.Address Does this help? "Russ" wrote: I appreciate any insights you experts can give to me. I want to use multiple command buttons on a single worksheet to print associated subsets (ranges) of worksheet data that may vary. In each case I would like to search the worksheet for "planted" text strings (that will indicate the upper-left and lower-right limits of a desired print range) and return those locations into the ActiveSheet.PageSetup.PrintArea = "loc upper-left:loc lower-right" function. Can this be accomplished? Thanks -- Russ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
The following may help to get you going. Assuming that your text string is in B4 - I assume you will know how to find the cell containing the string. Sub AAATest() Dim Parea Parea = Range("B4")'or Cells(4, 2) ActiveSheet.PageSetup.PrintArea = Parea End Sub regards, Don "Russ" wrote in message ... I appreciate any insights you experts can give to me. I want to use multiple command buttons on a single worksheet to print associated subsets (ranges) of worksheet data that may vary. In each case I would like to search the worksheet for "planted" text strings (that will indicate the upper-left and lower-right limits of a desired print range) and return those locations into the ActiveSheet.PageSetup.PrintArea = "loc upper-left:loc lower-right" function. Can this be accomplished? Thanks -- Russ |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
gocush, This helps but I am unclear on whether this technique will return
the location of the two cells of interest. Does Excel have a function that will return the "alpha:numeric" vector of a cell that contains a specified value? If so, I could search for that value and return the vector into the "PrintArea...." function. "gocush" wrote: A couple of ideas come to mind: 1. Create dynamic ranges, say MyRange1,...MyRange2 whatever: InsertNameDefine Enter MyRange1 in the Name box. Below in the RefersTo box enter (with the equal sign) =Offset(Sheet1!$B$2,0,0,CountA(Sheet1!$B$2:$B$1000 ),1) The 1st argument is the upper left cell of you range. The 1000 is beyond the max rows you will ever expect you will need. The last 1 is the number of columns in your range - its width. As you add/delete data to the lower end of your range or insert rows, the range definition changes to accomodate the data Then you can simply print this range with: ActiveSheet.PageSetup.PrintArea = MyRange1.Address Does this help? "Russ" wrote: I appreciate any insights you experts can give to me. I want to use multiple command buttons on a single worksheet to print associated subsets (ranges) of worksheet data that may vary. In each case I would like to search the worksheet for "planted" text strings (that will indicate the upper-left and lower-right limits of a desired print range) and return those locations into the ActiveSheet.PageSetup.PrintArea = "loc upper-left:loc lower-right" function. Can this be accomplished? Thanks -- Russ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Print Dynamic Range | Excel Discussion (Misc queries) | |||
Macro print range not dynamic like I wanted it to be | Excel Worksheet Functions | |||
Dynamic Print Range Help | Excel Worksheet Functions | |||
Excel 2000 VBA - Set Print Range in dynamic range | Excel Programming | |||
Dynamic Print Range | Excel Programming |