Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default user input "Rows to Repeat"

I'm writing a macro to create a formatted page that will print to my
specifications...the only part I can't figure out is:

When I ask the user if they need rows to repeat at top, how can they select
them manually and my macro still read it so that it can adjust the page setup
automatically?

Appreciate any help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default user input "Rows to Repeat"

Try using application.InputBox specify the type as "8" this tells excel that
you're expecting a range.
Dim UR As Range 'UserRange
Set UR = Application.InputBox(Prompt:="Please Select Header Range", _
Title:="Some Title", Type:=8)
If UR Is Nothing Then 'User didn't select do something
MsgBox "You didn't select anything"
End If

application.InputBox("Select Range","Hey Stupid",,,,,,8).Address
--
Charles Chickering

"A good example is twice the value of good advice."


"jasminesy" wrote:

I'm writing a macro to create a formatted page that will print to my
specifications...the only part I can't figure out is:

When I ask the user if they need rows to repeat at top, how can they select
them manually and my macro still read it so that it can adjust the page setup
automatically?

Appreciate any help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default user input "Rows to Repeat"

Dim rng as Range
set rng = Nothing
On error resume next
set rng = Application.Inputbox("Select rows to repreat at top",type:=8)
On Error goto 0
if not rng is nothing then
' rows were selected
set rng = rng.EntireRow
' set the rows to repeat at top
end if

--
Regards,
Tom Ogilvy

"jasminesy" wrote:

I'm writing a macro to create a formatted page that will print to my
specifications...the only part I can't figure out is:

When I ask the user if they need rows to repeat at top, how can they select
them manually and my macro still read it so that it can adjust the page setup
automatically?

Appreciate any help.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default user input "Rows to Repeat"

Just a heads up:

If the user doesn't select anything, the results is an error unless you have
error handling someplace you haven't shown.

when I ran your posted code, I got an error 424 object required.

--
Regards,
Tom Ogilvy


"Charles Chickering" wrote:

Try using application.InputBox specify the type as "8" this tells excel that
you're expecting a range.
Dim UR As Range 'UserRange
Set UR = Application.InputBox(Prompt:="Please Select Header Range", _
Title:="Some Title", Type:=8)
If UR Is Nothing Then 'User didn't select do something
MsgBox "You didn't select anything"
End If

application.InputBox("Select Range","Hey Stupid",,,,,,8).Address
--
Charles Chickering

"A good example is twice the value of good advice."


"jasminesy" wrote:

I'm writing a macro to create a formatted page that will print to my
specifications...the only part I can't figure out is:

When I ask the user if they need rows to repeat at top, how can they select
them manually and my macro still read it so that it can adjust the page setup
automatically?

Appreciate any help.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default user input "Rows to Repeat"

Still getting error...am I trying to do something I shouldn't here is the
beginning of my sub...this is the only area I'm having a problem with...even
setting the: Dim myrows as Range isn't working...


Sub props()
Titles = MsgBox("Do any rows need to repeat?", vbYesNo, "Repeating Titles")
If Titles = vbYes Then
Set myrows = Application.InputBox(prompt:="Select Rows", Type:=8)
Set myrows = myrows.EntireRow
With ActiveSheet.PageSetup
.PrintTitleRows = myrows
.PrintTitleColumns = ""
End With
Else: With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
End If


"Tom Ogilvy" wrote:

Dim rng as Range
set rng = Nothing
On error resume next
set rng = Application.Inputbox("Select rows to repreat at top",type:=8)
On Error goto 0
if not rng is nothing then
' rows were selected
set rng = rng.EntireRow
' set the rows to repeat at top
end if

--
Regards,
Tom Ogilvy

"jasminesy" wrote:

I'm writing a macro to create a formatted page that will print to my
specifications...the only part I can't figure out is:

When I ask the user if they need rows to repeat at top, how can they select
them manually and my macro still read it so that it can adjust the page setup
automatically?

Appreciate any help.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default user input "Rows to Repeat"

let me expand...it says "Unable to set the PrintTitleRows property of the
page setup class"....

"jasminesy" wrote:

Still getting error...am I trying to do something I shouldn't here is the
beginning of my sub...this is the only area I'm having a problem with...even
setting the: Dim myrows as Range isn't working...


Sub props()
Titles = MsgBox("Do any rows need to repeat?", vbYesNo, "Repeating Titles")
If Titles = vbYes Then
Set myrows = Application.InputBox(prompt:="Select Rows", Type:=8)
Set myrows = myrows.EntireRow
With ActiveSheet.PageSetup
.PrintTitleRows = myrows
.PrintTitleColumns = ""
End With
Else: With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
End If


"Tom Ogilvy" wrote:

Dim rng as Range
set rng = Nothing
On error resume next
set rng = Application.Inputbox("Select rows to repreat at top",type:=8)
On Error goto 0
if not rng is nothing then
' rows were selected
set rng = rng.EntireRow
' set the rows to repeat at top
end if

--
Regards,
Tom Ogilvy

"jasminesy" wrote:

I'm writing a macro to create a formatted page that will print to my
specifications...the only part I can't figure out is:

When I ask the user if they need rows to repeat at top, how can they select
them manually and my macro still read it so that it can adjust the page setup
automatically?

Appreciate any help.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default user input "Rows to Repeat"

Sub props()
Dim myRows as Range
Titles = MsgBox("Do any rows need to repeat?", vbYesNo, "Repeating Titles")
If Titles = vbYes Then
Set myrows = Application.InputBox(prompt:="Select Rows", Type:=8)
Set myrows = myrows.EntireRow
With ActiveSheet.PageSetup
.PrintTitleRows = myrows.address(1,1,xlA1)
.PrintTitleColumns = ""
End With
Else: With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
End If


--
Regards,
Tom Ogilvy


"jasminesy" wrote:

Still getting error...am I trying to do something I shouldn't here is the
beginning of my sub...this is the only area I'm having a problem with...even
setting the: Dim myrows as Range isn't working...


Sub props()
Titles = MsgBox("Do any rows need to repeat?", vbYesNo, "Repeating Titles")
If Titles = vbYes Then
Set myrows = Application.InputBox(prompt:="Select Rows", Type:=8)
Set myrows = myrows.EntireRow
With ActiveSheet.PageSetup
.PrintTitleRows = myrows
.PrintTitleColumns = ""
End With
Else: With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
End If


"Tom Ogilvy" wrote:

Dim rng as Range
set rng = Nothing
On error resume next
set rng = Application.Inputbox("Select rows to repreat at top",type:=8)
On Error goto 0
if not rng is nothing then
' rows were selected
set rng = rng.EntireRow
' set the rows to repeat at top
end if

--
Regards,
Tom Ogilvy

"jasminesy" wrote:

I'm writing a macro to create a formatted page that will print to my
specifications...the only part I can't figure out is:

When I ask the user if they need rows to repeat at top, how can they select
them manually and my macro still read it so that it can adjust the page setup
automatically?

Appreciate any help.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 272
Default user input "Rows to Repeat"

Tx for the correction Tom, I forgot that the InputBox does not just leave the
range as nothing when not used.
--
Charles Chickering

"A good example is twice the value of good advice."


"Tom Ogilvy" wrote:

Just a heads up:

If the user doesn't select anything, the results is an error unless you have
error handling someplace you haven't shown.

when I ran your posted code, I got an error 424 object required.

--
Regards,
Tom Ogilvy


"Charles Chickering" wrote:

Try using application.InputBox specify the type as "8" this tells excel that
you're expecting a range.
Dim UR As Range 'UserRange
Set UR = Application.InputBox(Prompt:="Please Select Header Range", _
Title:="Some Title", Type:=8)
If UR Is Nothing Then 'User didn't select do something
MsgBox "You didn't select anything"
End If

application.InputBox("Select Range","Hey Stupid",,,,,,8).Address
--
Charles Chickering

"A good example is twice the value of good advice."


"jasminesy" wrote:

I'm writing a macro to create a formatted page that will print to my
specifications...the only part I can't figure out is:

When I ask the user if they need rows to repeat at top, how can they select
them manually and my macro still read it so that it can adjust the page setup
automatically?

Appreciate any help.

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
page setup won't allow entering "rows to repeat at top" jasbrow Excel Discussion (Misc queries) 1 February 11th 08 08:34 PM
"Rows to repeat at Bottom" Abdul Kadar.W Excel Worksheet Functions 3 October 30th 07 01:38 PM
Help, Office 2007 "Rows to Repeat at Top" Dawn Excel Worksheet Functions 1 August 28th 07 04:06 PM
Help !!! Office 2007 "Rows to Repeat at top" how ???? Dawn Excel Discussion (Misc queries) 1 August 27th 07 11:03 PM
"Rows to repeat at top" option under page setup PaulandArt Excel Worksheet Functions 1 November 7th 05 02:13 PM


All times are GMT +1. The time now is 06:33 AM.

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"