Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Renaming Spreadsheets

I have a couple of problems for which any help would be greatly appreciated.
I have several workbooks where I have to amend the page number on each
spreadsheet. The page numbering does not necessarilly start on the first
spreadsheet so my first thought was to have an Input Box in which the start
position could be entered and for this to loop through the remaining sheets.
My first problem is that I can't get it to loop. Secondly, I wish to use the
&tab as a page footer which I have managed so long as I enter the array of
sheets to be formatted. Is there a way I can use the worksheets.count from
earlier in my code to fill this array or some other way? I have pasted my
code below. Many thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Renaming Spreadsheets

Opps! Forgot to paste my code: -

Dim i As Integer
Dim Response As Variant
Response = Application.InputBox( _
Prompt:="Enter the position of the spreadsheet at which you wish
the numbering to start", Type:=1)
If Response = False Then Exit Sub


For i = Reponse To Worksheets.Count
Sheets(i).Name = "Page " & Response - 1
Next

'Correct Page Numbering

Sheets(Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"11")).Select
Sheets("1").Activate

For Each wks In ActiveWindow.SelectedSheets
With wks.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = "&""Arial Black,Regular""&8&A"
.RightFooter = "&""Arial Black,Regular""&8WM PERFORMANCE SERVICES"
.LeftMargin = Application.InchesToPoints(0.590551181102362)
.RightMargin = Application.InchesToPoints(0.590551181102362)
.TopMargin = Application.InchesToPoints(0.393700787401575)
.BottomMargin = Application.InchesToPoints(0.393700787401575)
.HeaderMargin = Application.InchesToPoints(0.47244094488189)
.FooterMargin = Application.InchesToPoints(0.31496062992126)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = 2
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
Next wks

"Alpur" wrote:

I have a couple of problems for which any help would be greatly appreciated.
I have several workbooks where I have to amend the page number on each
spreadsheet. The page numbering does not necessarilly start on the first
spreadsheet so my first thought was to have an Input Box in which the start
position could be entered and for this to loop through the remaining sheets.
My first problem is that I can't get it to loop. Secondly, I wish to use the
&tab as a page footer which I have managed so long as I enter the array of
sheets to be formatted. Is there a way I can use the worksheets.count from
earlier in my code to fill this array or some other way? I have pasted my
code below. Many thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Renaming Spreadsheets

try something like this

for i=inputbox("Enter starting sheet") to worksheets.count
with sheets("page"&i).pagesetup

etc

end with
next i

--
Don Guillett
SalesAid Software

"Alpur" wrote in message
...
Opps! Forgot to paste my code: -

Dim i As Integer
Dim Response As Variant
Response = Application.InputBox( _
Prompt:="Enter the position of the spreadsheet at which you
wish
the numbering to start", Type:=1)
If Response = False Then Exit Sub


For i = Reponse To Worksheets.Count
Sheets(i).Name = "Page " & Response - 1
Next

'Correct Page Numbering

Sheets(Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"11")).Select
Sheets("1").Activate

For Each wks In ActiveWindow.SelectedSheets
With wks.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = "&""Arial Black,Regular""&8&A"
.RightFooter = "&""Arial Black,Regular""&8WM PERFORMANCE SERVICES"
.LeftMargin = Application.InchesToPoints(0.590551181102362)
.RightMargin = Application.InchesToPoints(0.590551181102362)
.TopMargin = Application.InchesToPoints(0.393700787401575)
.BottomMargin = Application.InchesToPoints(0.393700787401575)
.HeaderMargin = Application.InchesToPoints(0.47244094488189)
.FooterMargin = Application.InchesToPoints(0.31496062992126)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = 2
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
Next wks

"Alpur" wrote:

I have a couple of problems for which any help would be greatly
appreciated.
I have several workbooks where I have to amend the page number on each
spreadsheet. The page numbering does not necessarilly start on the first
spreadsheet so my first thought was to have an Input Box in which the
start
position could be entered and for this to loop through the remaining
sheets.
My first problem is that I can't get it to loop. Secondly, I wish to use
the
&tab as a page footer which I have managed so long as I enter the array
of
sheets to be formatted. Is there a way I can use the worksheets.count
from
earlier in my code to fill this array or some other way? I have pasted
my
code below. Many thanks.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Renaming Spreadsheets

Thanks Don. It has worked but a couple of points: - 1) the Input Box appears
twice before it starts rtunning and 2) It is very, very slow. Is there
anything I can do to alter this?

Al.

"Don Guillett" wrote:

try something like this

for i=inputbox("Enter starting sheet") to worksheets.count
with sheets("page"&i).pagesetup

etc

end with
next i

--
Don Guillett
SalesAid Software

"Alpur" wrote in message
...
Opps! Forgot to paste my code: -

Dim i As Integer
Dim Response As Variant
Response = Application.InputBox( _
Prompt:="Enter the position of the spreadsheet at which you
wish
the numbering to start", Type:=1)
If Response = False Then Exit Sub


For i = Reponse To Worksheets.Count
Sheets(i).Name = "Page " & Response - 1
Next

'Correct Page Numbering

Sheets(Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"11")).Select
Sheets("1").Activate

For Each wks In ActiveWindow.SelectedSheets
With wks.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = "&""Arial Black,Regular""&8&A"
.RightFooter = "&""Arial Black,Regular""&8WM PERFORMANCE SERVICES"
.LeftMargin = Application.InchesToPoints(0.590551181102362)
.RightMargin = Application.InchesToPoints(0.590551181102362)
.TopMargin = Application.InchesToPoints(0.393700787401575)
.BottomMargin = Application.InchesToPoints(0.393700787401575)
.HeaderMargin = Application.InchesToPoints(0.47244094488189)
.FooterMargin = Application.InchesToPoints(0.31496062992126)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = 2
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
Next wks

"Alpur" wrote:

I have a couple of problems for which any help would be greatly
appreciated.
I have several workbooks where I have to amend the page number on each
spreadsheet. The page numbering does not necessarilly start on the first
spreadsheet so my first thought was to have an Input Box in which the
start
position could be entered and for this to loop through the remaining
sheets.
My first problem is that I can't get it to loop. Secondly, I wish to use
the
&tab as a page footer which I have managed so long as I enter the array
of
sheets to be formatted. Is there a way I can use the worksheets.count
from
earlier in my code to fill this array or some other way? I have pasted
my
code below. Many thanks.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Renaming Spreadsheets

I looked again and tested this time but IF you did EXACTLY as I did the
input box should not have been twice but this will be much better. Page
setup is inherently SLOW. I can only suggest that you not change what
doesn't need changing

Sub dopagesetup()
numsheets = InputBox("Enter starting sheet")
For i = numsheets To Worksheets.Count - numsheets - 1
With Sheets("sheet" & i) '.PageSetup
MsgBox .Range("a1").Value
'etc
End With
Next i
End Sub

--
Don Guillett
SalesAid Software

"Don Guillett" wrote in message
...
try something like this

for i=inputbox("Enter starting sheet") to worksheets.count
with sheets("page"&i).pagesetup

etc

end with
next i

--
Don Guillett
SalesAid Software

"Alpur" wrote in message
...
Opps! Forgot to paste my code: -

Dim i As Integer
Dim Response As Variant
Response = Application.InputBox( _
Prompt:="Enter the position of the spreadsheet at which you
wish
the numbering to start", Type:=1)
If Response = False Then Exit Sub


For i = Reponse To Worksheets.Count
Sheets(i).Name = "Page " & Response - 1
Next

'Correct Page Numbering

Sheets(Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"11")).Select
Sheets("1").Activate

For Each wks In ActiveWindow.SelectedSheets
With wks.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = "&""Arial Black,Regular""&8&A"
.RightFooter = "&""Arial Black,Regular""&8WM PERFORMANCE SERVICES"
.LeftMargin = Application.InchesToPoints(0.590551181102362)
.RightMargin = Application.InchesToPoints(0.590551181102362)
.TopMargin = Application.InchesToPoints(0.393700787401575)
.BottomMargin = Application.InchesToPoints(0.393700787401575)
.HeaderMargin = Application.InchesToPoints(0.47244094488189)
.FooterMargin = Application.InchesToPoints(0.31496062992126)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = 2
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
Next wks

"Alpur" wrote:

I have a couple of problems for which any help would be greatly
appreciated.
I have several workbooks where I have to amend the page number on each
spreadsheet. The page numbering does not necessarilly start on the
first
spreadsheet so my first thought was to have an Input Box in which the
start
position could be entered and for this to loop through the remaining
sheets.
My first problem is that I can't get it to loop. Secondly, I wish to
use the
&tab as a page footer which I have managed so long as I enter the array
of
sheets to be formatted. Is there a way I can use the worksheets.count
from
earlier in my code to fill this array or some other way? I have pasted
my
code below. Many thanks.







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Renaming Spreadsheets

Many thanks again, Don, it works fine now.

Regards,

Al.

"Don Guillett" wrote:

I looked again and tested this time but IF you did EXACTLY as I did the
input box should not have been twice but this will be much better. Page
setup is inherently SLOW. I can only suggest that you not change what
doesn't need changing

Sub dopagesetup()
numsheets = InputBox("Enter starting sheet")
For i = numsheets To Worksheets.Count - numsheets - 1
With Sheets("sheet" & i) '.PageSetup
MsgBox .Range("a1").Value
'etc
End With
Next i
End Sub

--
Don Guillett
SalesAid Software

"Don Guillett" wrote in message
...
try something like this

for i=inputbox("Enter starting sheet") to worksheets.count
with sheets("page"&i).pagesetup

etc

end with
next i

--
Don Guillett
SalesAid Software

"Alpur" wrote in message
...
Opps! Forgot to paste my code: -

Dim i As Integer
Dim Response As Variant
Response = Application.InputBox( _
Prompt:="Enter the position of the spreadsheet at which you
wish
the numbering to start", Type:=1)
If Response = False Then Exit Sub


For i = Reponse To Worksheets.Count
Sheets(i).Name = "Page " & Response - 1
Next

'Correct Page Numbering

Sheets(Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"11")).Select
Sheets("1").Activate

For Each wks In ActiveWindow.SelectedSheets
With wks.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = "&""Arial Black,Regular""&8&A"
.RightFooter = "&""Arial Black,Regular""&8WM PERFORMANCE SERVICES"
.LeftMargin = Application.InchesToPoints(0.590551181102362)
.RightMargin = Application.InchesToPoints(0.590551181102362)
.TopMargin = Application.InchesToPoints(0.393700787401575)
.BottomMargin = Application.InchesToPoints(0.393700787401575)
.HeaderMargin = Application.InchesToPoints(0.47244094488189)
.FooterMargin = Application.InchesToPoints(0.31496062992126)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = 2
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
Next wks

"Alpur" wrote:

I have a couple of problems for which any help would be greatly
appreciated.
I have several workbooks where I have to amend the page number on each
spreadsheet. The page numbering does not necessarilly start on the
first
spreadsheet so my first thought was to have an Input Box in which the
start
position could be entered and for this to loop through the remaining
sheets.
My first problem is that I can't get it to loop. Secondly, I wish to
use the
&tab as a page footer which I have managed so long as I enter the array
of
sheets to be formatted. Is there a way I can use the worksheets.count
from
earlier in my code to fill this array or some other way? I have pasted
my
code below. Many thanks.






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Renaming Spreadsheets

glad it helped

--
Don Guillett
SalesAid Software

"Alpur" wrote in message
...
Many thanks again, Don, it works fine now.

Regards,

Al.

"Don Guillett" wrote:

I looked again and tested this time but IF you did EXACTLY as I did the
input box should not have been twice but this will be much better. Page
setup is inherently SLOW. I can only suggest that you not change what
doesn't need changing

Sub dopagesetup()
numsheets = InputBox("Enter starting sheet")
For i = numsheets To Worksheets.Count - numsheets - 1
With Sheets("sheet" & i) '.PageSetup
MsgBox .Range("a1").Value
'etc
End With
Next i
End Sub

--
Don Guillett
SalesAid Software

"Don Guillett" wrote in message
...
try something like this

for i=inputbox("Enter starting sheet") to worksheets.count
with sheets("page"&i).pagesetup

etc

end with
next i

--
Don Guillett
SalesAid Software

"Alpur" wrote in message
...
Opps! Forgot to paste my code: -

Dim i As Integer
Dim Response As Variant
Response = Application.InputBox( _
Prompt:="Enter the position of the spreadsheet at which you
wish
the numbering to start", Type:=1)
If Response = False Then Exit Sub


For i = Reponse To Worksheets.Count
Sheets(i).Name = "Page " & Response - 1
Next

'Correct Page Numbering

Sheets(Array("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"11")).Select
Sheets("1").Activate

For Each wks In ActiveWindow.SelectedSheets
With wks.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = "&""Arial Black,Regular""&8&A"
.RightFooter = "&""Arial Black,Regular""&8WM PERFORMANCE
SERVICES"
.LeftMargin = Application.InchesToPoints(0.590551181102362)
.RightMargin = Application.InchesToPoints(0.590551181102362)
.TopMargin = Application.InchesToPoints(0.393700787401575)
.BottomMargin = Application.InchesToPoints(0.393700787401575)
.HeaderMargin = Application.InchesToPoints(0.47244094488189)
.FooterMargin = Application.InchesToPoints(0.31496062992126)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = 2
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
Next wks

"Alpur" wrote:

I have a couple of problems for which any help would be greatly
appreciated.
I have several workbooks where I have to amend the page number on
each
spreadsheet. The page numbering does not necessarilly start on the
first
spreadsheet so my first thought was to have an Input Box in which the
start
position could be entered and for this to loop through the remaining
sheets.
My first problem is that I can't get it to loop. Secondly, I wish to
use the
&tab as a page footer which I have managed so long as I enter the
array
of
sheets to be formatted. Is there a way I can use the
worksheets.count
from
earlier in my code to fill this array or some other way? I have
pasted
my
code below. Many thanks.







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
Can Excel Spreadsheets be saved as Microsoft Works spreadsheets? EXCEL WORKS CONFUSED Excel Discussion (Misc queries) 4 August 18th 06 11:21 PM
Renaming Defined Name rickv Excel Discussion (Misc queries) 0 August 5th 05 11:50 PM
renaming No Name Excel Programming 1 October 11th 04 05:01 PM
Renaming ianripping[_66_] Excel Programming 3 May 22nd 04 12:02 PM
Renaming within VBA Brent McIntyre Excel Programming 4 August 21st 03 02:10 AM


All times are GMT +1. The time now is 02:13 AM.

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

About Us

"It's about Microsoft Excel"