Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
PrintOut macro from ?passed range.addrsess
I am trying to print portions of a worksheet determined by selection from a
comboBox (Cmbindividual) on a user form (form) on clicking a button (Cmdchoose)....code: (rng is a public variable!) ---------------------------------------------------------------- Public Sub Cmdchoose_Click() If Cmbindividual.ListIndex -1 Then indivindex = Cmbindividual.ListIndex form.Hide Select Case indivindex ' Evaluate Number based on name of individual selected Case 0 Set rng = Range("r139:ah173") ActiveSheet.ScrollArea = rng.Address Range("s140").Select ActiveWindow.LargeScroll Down:=2 ActiveWindow.LargeScroll ToRight:=2 ActiveWindow.LargeScroll Down:=-2 ActiveWindow.LargeScroll ToRight:=-2 Case 1 Set rng = Range("s179:ah213") ActiveSheet.ScrollArea = rng.Address Range("ah212").Select ActiveWindow.LargeScroll Down:=2 ActiveWindow.LargeScroll ToRight:=2 ActiveWindow.LargeScroll Down:=-2 ActiveWindow.LargeScroll ToRight:=-2 Case 2 Set rng = Range("r219:ah253") ActiveSheet.ScrollArea = rng.Address Range("s220").Select ActiveWindow.LargeScroll Down:=2 ActiveWindow.LargeScroll ToRight:=2 ActiveWindow.LargeScroll Down:=-2 ActiveWindow.LargeScroll ToRight:=-2 Case 3 ETC. End Select End If End Sub ---------------------------------------------------------------- (The scrolls are to get the thing into frame and I know there are coding ways to select the appropriate ranges but it was late Friday PM!!!!) What I'd like to do is put a button into each range to print out that range. I've tried: ---------------------------------------------------------------- Private Sub CommandButton3_Click() With ActiveSheet .PageSetup.PrintArea = rng .PageSetup.Orientation = xlLandscape .rng.PrintOut End With End Sub ---------------------------------------------------------------- CommandButton3 is copied to each range The rng variable applies to the ScrollArea command but rung CommandButton3_click routine and I get an 'object required' error. Any help would be apprecitated. Thanks -- Jabba |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
PrintOut macro from ?passed range.addrsess
Maybe:
With ActiveSheet .PageSetup.PrintArea = rng.address(external:=true) Jabba wrote: I am trying to print portions of a worksheet determined by selection from a comboBox (Cmbindividual) on a user form (form) on clicking a button (Cmdchoose)....code: (rng is a public variable!) ---------------------------------------------------------------- Public Sub Cmdchoose_Click() If Cmbindividual.ListIndex -1 Then indivindex = Cmbindividual.ListIndex form.Hide Select Case indivindex ' Evaluate Number based on name of individual selected Case 0 Set rng = Range("r139:ah173") ActiveSheet.ScrollArea = rng.Address Range("s140").Select ActiveWindow.LargeScroll Down:=2 ActiveWindow.LargeScroll ToRight:=2 ActiveWindow.LargeScroll Down:=-2 ActiveWindow.LargeScroll ToRight:=-2 Case 1 Set rng = Range("s179:ah213") ActiveSheet.ScrollArea = rng.Address Range("ah212").Select ActiveWindow.LargeScroll Down:=2 ActiveWindow.LargeScroll ToRight:=2 ActiveWindow.LargeScroll Down:=-2 ActiveWindow.LargeScroll ToRight:=-2 Case 2 Set rng = Range("r219:ah253") ActiveSheet.ScrollArea = rng.Address Range("s220").Select ActiveWindow.LargeScroll Down:=2 ActiveWindow.LargeScroll ToRight:=2 ActiveWindow.LargeScroll Down:=-2 ActiveWindow.LargeScroll ToRight:=-2 Case 3 ETC. End Select End If End Sub ---------------------------------------------------------------- (The scrolls are to get the thing into frame and I know there are coding ways to select the appropriate ranges but it was late Friday PM!!!!) What I'd like to do is put a button into each range to print out that range. I've tried: ---------------------------------------------------------------- Private Sub CommandButton3_Click() With ActiveSheet .PageSetup.PrintArea = rng .PageSetup.Orientation = xlLandscape .rng.PrintOut End With End Sub ---------------------------------------------------------------- CommandButton3 is copied to each range The rng variable applies to the ScrollArea command but rung CommandButton3_click routine and I get an 'object required' error. Any help would be apprecitated. Thanks -- Jabba -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
ClearContents method on a passed range | New Users to Excel | |||
segregating passed range by rows and columns | Excel Programming | |||
Translate range name passed as string to a custom function to range addresses! | Excel Programming | |||
Error Converting Passed Range into Array in VBA for Excel | Excel Programming | |||
Error Converting Passed Range into Array in VBA for Excel | Excel Programming |