Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ClearContents method on a passed range bryan New Users to Excel 2 January 19th 05 08:49 AM
segregating passed range by rows and columns Michael Malinsky[_3_] Excel Programming 1 September 15th 04 05:30 PM
Translate range name passed as string to a custom function to range addresses! agarwaldvk[_25_] Excel Programming 3 September 7th 04 12:47 PM
Error Converting Passed Range into Array in VBA for Excel Alan Beban[_2_] Excel Programming 0 September 1st 04 04:56 PM
Error Converting Passed Range into Array in VBA for Excel Dave Peterson[_3_] Excel Programming 0 September 1st 04 01:17 AM


All times are GMT +1. The time now is 06:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"