Önizleme sayfa ayarı

aydgur

Altın Üye
Katılım
31 Ekim 2005
Mesajlar
451
Excel Vers. ve Dili
Excel 2007 Türkçe
Altın Üyelik Bitiş Tarihi
04-03-2028
Mevcut makroya ;önizleme ayarlar,kenar boşluları sağ ve sol 0 değerinde olsun eklemek istiyorum.Yani makroda otomatik olarak sayfa yzadırılmadan önce kenar boşluklarını 0yapmak istiyorum ,acaba mümkünmü ?
 
Katılım
2 Mart 2005
Mesajlar
2,960
Excel Vers. ve Dili
ev: Ofis 2007- Win Xp
iş: Ofis 2010- Win Vista
Aşağıdaki Kod Sayfa yapısını belirliyor size yeşil olanlar yeterli diğer özellikleride belirlemeniz mümkün tabi.

Kod:
[B][COLOR=SeaGreen]Sub Makro1()[/COLOR][/B]
'
' Makro1 Makro
' Makro CASPER tarafından 13.03.2008 tarihinde kaydedildi.
'

'
[B][COLOR=SeaGreen]    With ActiveSheet.PageSetup[/COLOR][/B]
        .PrintTitleRows = ""                  'Üstte yinelenecek satırlar
        .PrintTitleColumns = ""               'Solda yinelenecek satırlar
    End With
    ActiveSheet.PageSetup.PrintArea = ""      'Yazdırma Alanı mesala A1:F100
    With ActiveSheet.PageSetup
        .LeftHeader = ""
        .CenterHeader = ""
        .RightHeader = ""
        .LeftFooter = ""
        .CenterFooter = ""
        .RightFooter = ""
 [B][COLOR=SeaGreen]       .LeftMargin = Application.InchesToPoints(0)                     'Sol Marj Ayarı
        .RightMargin = Application.InchesToPoints(0)                    'Sağ Marj Ayarı[/COLOR][/B]
        .TopMargin = Application.InchesToPoints(0.984251968503937)      'üst Marj Ayarı = 2.5 cm
        .BottomMargin = Application.InchesToPoints(0.984251968503937)   'Alt Marj Ayarı
        .HeaderMargin = Application.InchesToPoints(0.511811023622047)   'Üst bilgi marj ayarı
        .FooterMargin = Application.InchesToPoints(0.511811023622047)   'Alt bilgi marj ayarı
        .PrintHeadings = False                                          'Başlıklar yazdırılsınmı?
        .PrintGridlines = False
        .PrintComments = xlPrintNoComments
        .PrintQuality = 600
        .CenterHorizontally = False
        .CenterVertically = False
        .Orientation = xlPortrait
        .Draft = False
        .PaperSize = xlPaperA4
        .FirstPageNumber = xlAutomatic
        .Order = xlDownThenOver
        .BlackAndWhite = False
        .Zoom = 100
        .PrintErrors = xlPrintErrorsDisplayed
[B][COLOR=SeaGreen]    End With
End Sub[/COLOR][/B]
 

aydgur

Altın Üye
Katılım
31 Ekim 2005
Mesajlar
451
Excel Vers. ve Dili
Excel 2007 Türkçe
Altın Üyelik Bitiş Tarihi
04-03-2028
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
Range("A6").Select
ActiveWindow.FreezePanes = True
ActiveWindow.SmallScroll Down:=-9
ActiveSheet.PageSetup.PrintArea = "A1:J63"
LeftMargin = Application.InchesToPoints(0)
RightMargin = Application.InchesToPoints(0)
Columns("A").ColumnWidth = 7
Columns("B").ColumnWidth = 6.43
Columns("C").ColumnWidth = 7
Columns("D").ColumnWidth = 9
Columns("E").ColumnWidth = 12.57
Columns("F").ColumnWidth = 9
Columns("G").ColumnWidth = 8
Columns("H").ColumnWidth = 12.29
Columns("I").ColumnWidth = 12.29
Columns("J").ColumnWidth = 12.29
Range("G1:H1").Select
Selection.ClearContents
Range("B1").Select
ActiveCell.FormulaR1C1 = Range("ANASAYFA!Q21")
Range("B1").Select

End Sub
Kodu böyle yazdım ama hiçbir değişiklik olmadı
 

Seyit Tiken

Uzman
Uzman
Katılım
23 Ağustos 2005
Mesajlar
4,651
Excel Vers. ve Dili
Excel : 2010
Bu şekilde deneyebilirsiniz.
Kod:
Sub Makro2()
With Sayfa1.PageSetup
.LeftMargin = 0
.RightMargin = 0
.TopMargin = 0
.BottomMargin = 0
End With
End Sub
 

aydgur

Altın Üye
Katılım
31 Ekim 2005
Mesajlar
451
Excel Vers. ve Dili
Excel 2007 Türkçe
Altın Üyelik Bitiş Tarihi
04-03-2028
Sub Makro2()
'Sheets("anasayfa").Select
Range("B25").Select
Sheets("ANASAYFA").Select
Set Newsh = Worksheets.Add(After:=Sheets(Sheets.Count))
Newsh.Name = Sheets("ANASAYFA").Range("Q21")

Cells.Select

'
Range("A1").Select
ActiveCell.FormulaR1C1 = "FİRMA"
Range("A2").Select
ActiveCell.FormulaR1C1 = "YETKİLİ"
Range("A3").Select
ActiveCell.FormulaR1C1 = "ADRES"
Range("B1:E1").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Selection.Copy
Range("B2").Select
ActiveSheet.Paste
Range("B3").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("F1").Select
ActiveCell.FormulaR1C1 = "TELEFON"
Range("F2").Select
ActiveCell.FormulaR1C1 = "GSM"
Range("F3").Select
ActiveCell.FormulaR1C1 = "FAX"
Cells.Select
With Selection.Font
.Name = "Arial Tur"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("G1:H1").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Selection.Copy
Range("G2").Select
ActiveSheet.Paste
Range("G3").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("I1").Select
ActiveCell.FormulaR1C1 = "BORÇLARI"
Range("I2").Select
ActiveCell.FormulaR1C1 = "ÖDEMELERİ"
Range("I3").Select
ActiveCell.FormulaR1C1 = "BAKİYE"
Range("A1:E3").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("F1:H3").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("I1:J3").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("A5").Select
ActiveCell.FormulaR1C1 = "TARİH"
Range("B5").Select
ActiveCell.FormulaR1C1 = "FAT.NO"
Range("C5").Select
ActiveCell.FormulaR1C1 = "VADE"
Range("D5").Select
ActiveCell.FormulaR1C1 = "AÇIKLAMA"
Range("E5").Select
ActiveCell.FormulaR1C1 = "CİNSİ"
Range("F5").Select
ActiveCell.FormulaR1C1 = "KG"
Range("G5").Select
ActiveCell.FormulaR1C1 = "FİYAT"
Range("H5").Select
ActiveCell.FormulaR1C1 = "TUTARI"
Range("I5").Select
ActiveCell.FormulaR1C1 = "ÖDENEN"
Range("J5").Select
ActiveCell.FormulaR1C1 = "BAKİYE"
Rows("4:4").Select
With Selection.Interior
.ColorIndex = 2
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Range("C7").Select
Rows("4:4").RowHeight = 8.25
Range("A:A,C:C").Select
Range("C4").Activate
Selection.ColumnWidth = 7
Columns("B:B").Select
Range("B4").Activate
Selection.ColumnWidth = 6.4
Columns("D:D").Select
Range("D4").Activate
Selection.ColumnWidth = 9.05
Columns("E:E").Select
Range("E4").Activate
Selection.ColumnWidth = 12.5
Columns("F:F").Select
Selection.ColumnWidth = 9
Columns("G:G").Select
Range("G4").Activate
Selection.ColumnWidth = 8
Columns("H:J").Select
Range("H4").Activate
Selection.ColumnWidth = 12.3
Range("A:A,C:C").Select
Range("C4").Activate
Selection.NumberFormat = "dd/mm/yy;@"
Columns("B:B").Select
Range("B4").Activate
Selection.NumberFormat = "#,##0"
Range("A5:J5").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Columns("F:F").Select
Selection.NumberFormat = "#,##0.00"
Columns("G:J").Select
Range("G4").Activate
Selection.NumberFormat = "#,##0.00 $"
Range("G1:H1").Select
ActiveCell.FormulaR1C1 = "120"
Range("G1:H3").Select
Selection.NumberFormat = "General"
Range("H6:H5000").Select
Selection.FormulaR1C1 = "=RC[-2]*RC[-1]"
Range("J1").Select
ActiveCell.FormulaR1C1 = "=SUM(R[5]C[-2]:R[4999]C[-2])"
Range("J2").Select
ActiveCell.FormulaR1C1 = "=SUM(R[4]C[-1]:R[4998]C[-1])"
Range("J3").Select
ActiveCell.FormulaR1C1 = "=R[-2]C-R[-1]C"
Range("J6").Select
ActiveCell.FormulaR1C1 = "=RC[-2]-RC[-1]"
Range("J7").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-9]>0,(RC[-2]-RC[-1])+R[-1]C,"""")"
Range("J7").Select
Selection.Copy
Range("J8:J5000").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1").Select
ActiveWindow.DisplayZeros = False
Range("A5:J5000").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("A5:J5").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic


End With
Range("A6").Select
ActiveWindow.FreezePanes = True
ActiveWindow.SmallScroll Down:=-9
ActiveSheet.PageSetup.PrintArea = "A1:J63"
LeftMargin = 0
RightMargin = 0
Columns("A").ColumnWidth = 7
Columns("B").ColumnWidth = 6.43
Columns("C").ColumnWidth = 7
Columns("D").ColumnWidth = 9
Columns("E").ColumnWidth = 12.57
Columns("F").ColumnWidth = 9
Columns("G").ColumnWidth = 8
Columns("H").ColumnWidth = 12.29
Columns("I").ColumnWidth = 12.29
Columns("J").ColumnWidth = 12.29
Range("G1:H1").Select
Selection.ClearContents
Range("B1").Select
ActiveCell.FormulaR1C1 = Range("ANASAYFA!Q21")
Range("B1").Select

End Sub
Yeni sayfa açmak için bu makroyu kullanıyorum.Sayfayı yazdırmak için kenar boşluklarını 0 yapıp ayarlamak zorunda kalıyorum ,bu makro içinde nasıl yapabilirim.
 
Üst