Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default problem column (B)

Procedure opens column (F) to wrap text (from shrink to fit)
Turns print to lanscape
Supposed to count column (B) to determine what to print (works in other
places)
remove print area from worksheet
Column (F) back to shrink to fit.
Question am I trying to do to much in one procedure. I don't know.
Will enclose entire procedure with my attempts blocked.
It prints all records not useing (B) as counter Also no grid lines as needed.
This is the biggest procedure I have ever tried.
If anyone can sort this out I will be eternaly gratfull .
Thank All
here it is

Private Sub OptionButton32_Click()
'Print Announcer Parade Sheets
OptionButton32.Value = False
'With Sheets("Announcer")
' pCnt = Application.InputBox("How Many Copies from 1-9", Type:=1)
' If pCnt < 1 Or pCnt 9 Then Exit Sub
' ActiveWindow.SelectedSheets.PrintOut Copies:=pCnt, Collate:=True
' Worksheets("Announcer").pagesetup.PrintGridlines = True
' .pagesetup.PrintArea = "A2:F" & Cells(Rows.Count,
"B").End(xlUp).Row
' End With
Sheets("Announcer").Select
Columns("F").Select
With Selection
Application.ScreenUpdating = False
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.MergeCells = False
Application.ScreenUpdating = True
End With
' Sheets("Announcer").Select
' With Sheets("Announcer")
' pCnt = Application.InputBox("How Many Copies from 1-9", Type:=1)
' If pCnt < 1 Or pCnt 9 Then Exit Sub
' ActiveWindow.SelectedSheets.PrintOut Copies:=pCnt, Collate:=True
' Worksheets("Announcer").pagesetup.PrintGridlines = True
' .pagesetup.PrintArea = "A2:F" & Cells(Rows.Count,
"B").End(xlUp).Row
' End With
Application.ScreenUpdating = False
With ActiveSheet.pagesetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = True
.PrintComments = xlPrintNoComments
.PrintQuality = -3
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
Application.ScreenUpdating = True
With Sheets("Announcer")
pCnt = Application.InputBox("How Many Copies from 1-9", Type:=1)
If pCnt < 1 Or pCnt 9 Then Exit Sub
ActiveWindow.SelectedSheets.PrintOut Copies:=pCnt, Collate:=True
Worksheets("Announcer").pagesetup.PrintGridlines = True
.pagesetup.PrintArea = "A2:F" & Cells(Rows.Count, "B").End(xlUp).Row
End With
ActiveSheet.pagesetup.PrintArea = ""
Columns("F").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = True
.MergeCells = False
End With
End With
Range("G4").Select
End Sub





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default problem column (B)

Your code look great, no problem with the size of the macro. Your WITH
statements and END WITH are out of sequence. You hae two END WITH together
at the end. You also seem to have the code out of order

from:
ActiveWindow.SelectedSheets.PrintOut _
Copies:=pCnt, Collate:=True
Worksheets("Announcer"). _
<= Prints
PageSetup.PrintGridlines = True
.PageSetup.PrintArea = _
"A2:F" & Cells(Rows.Count, "B").End(xlUp).Row <= Page Area

to:

ActiveWindow.SelectedSheets.PrintOut _
Copies:=pCnt, Collate:=True
.PageSetup.PrintArea = _
"A2:F" & Cells(Rows.Count, "B").End(xlUp).Row <= Page Area
Worksheets("Announcer"). _
<= Prints
PageSetup.PrintGridlines = True


I would try stepping through the code and switch back and forth from
worksheet to VBA and watch which cells are being selected to test the code.

1) Go to VBA window and select the line below with mouse
OptionButton32.Value = False
2) Press F9 - line will change color
3) go to worksheeet and activate the Control Button
4) step through code using the F8 button

Go to VBA window
"Curt" wrote:

Procedure opens column (F) to wrap text (from shrink to fit)
Turns print to lanscape
Supposed to count column (B) to determine what to print (works in other
places)
remove print area from worksheet
Column (F) back to shrink to fit.
Question am I trying to do to much in one procedure. I don't know.
Will enclose entire procedure with my attempts blocked.
It prints all records not useing (B) as counter Also no grid lines as needed.
This is the biggest procedure I have ever tried.
If anyone can sort this out I will be eternaly gratfull .
Thank All
here it is

Private Sub OptionButton32_Click()
'Print Announcer Parade Sheets
OptionButton32.Value = False
'With Sheets("Announcer")
' pCnt = Application.InputBox("How Many Copies from 1-9", Type:=1)
' If pCnt < 1 Or pCnt 9 Then Exit Sub
' ActiveWindow.SelectedSheets.PrintOut Copies:=pCnt, Collate:=True
' Worksheets("Announcer").pagesetup.PrintGridlines = True
' .pagesetup.PrintArea = "A2:F" & Cells(Rows.Count,
"B").End(xlUp).Row
' End With
Sheets("Announcer").Select
Columns("F").Select
With Selection
Application.ScreenUpdating = False
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.MergeCells = False
Application.ScreenUpdating = True
End With
' Sheets("Announcer").Select
' With Sheets("Announcer")
' pCnt = Application.InputBox("How Many Copies from 1-9", Type:=1)
' If pCnt < 1 Or pCnt 9 Then Exit Sub
' ActiveWindow.SelectedSheets.PrintOut Copies:=pCnt, Collate:=True
' Worksheets("Announcer").pagesetup.PrintGridlines = True
' .pagesetup.PrintArea = "A2:F" & Cells(Rows.Count,
"B").End(xlUp).Row
' End With
Application.ScreenUpdating = False
With ActiveSheet.pagesetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = True
.PrintComments = xlPrintNoComments
.PrintQuality = -3
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
Application.ScreenUpdating = True
With Sheets("Announcer")
pCnt = Application.InputBox("How Many Copies from 1-9", Type:=1)
If pCnt < 1 Or pCnt 9 Then Exit Sub
ActiveWindow.SelectedSheets.PrintOut Copies:=pCnt, Collate:=True
Worksheets("Announcer").pagesetup.PrintGridlines = True
.pagesetup.PrintArea = "A2:F" & Cells(Rows.Count, "B").End(xlUp).Row
End With
ActiveSheet.pagesetup.PrintArea = ""
Columns("F").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = True
.MergeCells = False
End With
End With
Range("G4").Select
End Sub





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default problem column (B)

Thanks for the direction the f8 f9 i was not aware of. Guess that comes from
lack of schooling
Thanks Again

"Joel" wrote:

Your code look great, no problem with the size of the macro. Your WITH
statements and END WITH are out of sequence. You hae two END WITH together
at the end. You also seem to have the code out of order

from:
ActiveWindow.SelectedSheets.PrintOut _
Copies:=pCnt, Collate:=True
Worksheets("Announcer"). _
<= Prints
PageSetup.PrintGridlines = True
.PageSetup.PrintArea = _
"A2:F" & Cells(Rows.Count, "B").End(xlUp).Row <= Page Area

to:

ActiveWindow.SelectedSheets.PrintOut _
Copies:=pCnt, Collate:=True
.PageSetup.PrintArea = _
"A2:F" & Cells(Rows.Count, "B").End(xlUp).Row <= Page Area
Worksheets("Announcer"). _
<= Prints
PageSetup.PrintGridlines = True


I would try stepping through the code and switch back and forth from
worksheet to VBA and watch which cells are being selected to test the code.

1) Go to VBA window and select the line below with mouse
OptionButton32.Value = False
2) Press F9 - line will change color
3) go to worksheeet and activate the Control Button
4) step through code using the F8 button

Go to VBA window
"Curt" wrote:

Procedure opens column (F) to wrap text (from shrink to fit)
Turns print to lanscape
Supposed to count column (B) to determine what to print (works in other
places)
remove print area from worksheet
Column (F) back to shrink to fit.
Question am I trying to do to much in one procedure. I don't know.
Will enclose entire procedure with my attempts blocked.
It prints all records not useing (B) as counter Also no grid lines as needed.
This is the biggest procedure I have ever tried.
If anyone can sort this out I will be eternaly gratfull .
Thank All
here it is

Private Sub OptionButton32_Click()
'Print Announcer Parade Sheets
OptionButton32.Value = False
'With Sheets("Announcer")
' pCnt = Application.InputBox("How Many Copies from 1-9", Type:=1)
' If pCnt < 1 Or pCnt 9 Then Exit Sub
' ActiveWindow.SelectedSheets.PrintOut Copies:=pCnt, Collate:=True
' Worksheets("Announcer").pagesetup.PrintGridlines = True
' .pagesetup.PrintArea = "A2:F" & Cells(Rows.Count,
"B").End(xlUp).Row
' End With
Sheets("Announcer").Select
Columns("F").Select
With Selection
Application.ScreenUpdating = False
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.MergeCells = False
Application.ScreenUpdating = True
End With
' Sheets("Announcer").Select
' With Sheets("Announcer")
' pCnt = Application.InputBox("How Many Copies from 1-9", Type:=1)
' If pCnt < 1 Or pCnt 9 Then Exit Sub
' ActiveWindow.SelectedSheets.PrintOut Copies:=pCnt, Collate:=True
' Worksheets("Announcer").pagesetup.PrintGridlines = True
' .pagesetup.PrintArea = "A2:F" & Cells(Rows.Count,
"B").End(xlUp).Row
' End With
Application.ScreenUpdating = False
With ActiveSheet.pagesetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = True
.PrintComments = xlPrintNoComments
.PrintQuality = -3
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
Application.ScreenUpdating = True
With Sheets("Announcer")
pCnt = Application.InputBox("How Many Copies from 1-9", Type:=1)
If pCnt < 1 Or pCnt 9 Then Exit Sub
ActiveWindow.SelectedSheets.PrintOut Copies:=pCnt, Collate:=True
Worksheets("Announcer").pagesetup.PrintGridlines = True
.pagesetup.PrintArea = "A2:F" & Cells(Rows.Count, "B").End(xlUp).Row
End With
ActiveSheet.pagesetup.PrintArea = ""
Columns("F").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = True
.MergeCells = False
End With
End With
Range("G4").Select
End Sub





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
CSV all in one column problem [email protected] Excel Discussion (Misc queries) 2 January 4th 09 06:31 PM
Please help with a column/row transposing problem [email protected] Excel Programming 8 July 26th 06 10:31 AM
Column Problem Help Please! Alisonatwork Excel Worksheet Functions 2 January 18th 06 06:26 AM
Column Header Problem Waylon Excel Worksheet Functions 3 December 8th 04 06:23 PM
Problem when trying to convert one column with multiple rows to one row with multiple column marcello Excel Programming 1 February 23rd 04 03:03 AM


All times are GMT +1. The time now is 11:43 PM.

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"