mkarakas_58
Altın Üye
- Katılım
- 28 Haziran 2009
- Mesajlar
- 51
- Excel Vers. ve Dili
- 2019 Türkçe
- Altın Üyelik Bitiş Tarihi
- 11-05-2025
Merhaba arkadaşlar, makro kaydet ile kendi bilgisayarımda makro oluşturdum.
Oluşturduğum makroyla yeni bir excel dosyası açarak masaüstüne farklı isimle ve birkaç düzenleme yaptırıyorum.
Kendi bilgisayarımda sorunsuz çalışıyor. Ben istiyorum ki başka bilgisayarlardada sorunsuz çalışsın.
Farklı bilgisayarlarda kullanıcı isimleri farklı olduğundan kodlar hata veriyor.
Sizden ricam aşağıdaki kodu nasıl değiştirirsem, sorun düzelir. İstediğim masa üstüne veya ana excel dosyasının yanına kaydetsin.
Yardımlarınız için teşekkür ederim.
Oluşturduğum makroyla yeni bir excel dosyası açarak masaüstüne farklı isimle ve birkaç düzenleme yaptırıyorum.
Kendi bilgisayarımda sorunsuz çalışıyor. Ben istiyorum ki başka bilgisayarlardada sorunsuz çalışsın.
Farklı bilgisayarlarda kullanıcı isimleri farklı olduğundan kodlar hata veriyor.
Sizden ricam aşağıdaki kodu nasıl değiştirirsem, sorun düzelir. İstediğim masa üstüne veya ana excel dosyasının yanına kaydetsin.
Yardımlarınız için teşekkür ederim.
Kod:
Sub ödenekhesapla()
'
' ödenekhesapla Makro
'
'
Sheets("ÖDENEK İSTEM TABLOSU").Select
Sheets("ÖDENEK İSTEM TABLOSU").Copy
Range("T1:AF33").Select
Selection.Copy
Sheets.Add After:=ActiveSheet
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Columns("A:A").EntireColumn.AutoFit
Columns("A:A").ColumnWidth = 4.86
Range("A3:A4").Select
Selection.AutoFill Destination:=Range("A3:A32"), Type:=xlFillDefault
Range("A3:A32").Select
Range("B1:M1").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
Range("A1:M1").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Selection.UnMerge
Columns("B:B").ColumnWidth = 17.57
Columns("D:D").ColumnWidth = 15
Rows("2:2").Select
Selection.RowHeight = 36
Selection.RowHeight = 42.75
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Font.Bold = True
Columns("A:A").Select
Selection.Font.Bold = True
Range("A1:M1").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.Font.Size = 12
Selection.Font.Size = 14
Selection.Font.Size = 16
Selection.Font.Size = 18
Selection.Font.Size = 20
Columns("L:L").ColumnWidth = 10.71
Columns("L:L").ColumnWidth = 27.57
Columns("K:K").ColumnWidth = 15.57
Columns("J:J").ColumnWidth = 14.14
Columns("I:I").ColumnWidth = 13.86
Columns("H:H").ColumnWidth = 11.71
Columns("G:G").ColumnWidth = 11
Columns("F:F").ColumnWidth = 14
Columns("E:E").ColumnWidth = 11.57
Columns("D:D").ColumnWidth = 19.57
Columns("C:C").ColumnWidth = 10.71
Columns("B:B").ColumnWidth = 24.57
Columns("B:B").ColumnWidth = 26
Rows("3:32").Select
Selection.RowHeight = 30
Range("B3:D26").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
ActiveWindow.SmallScroll Down:=-21
Range("A2:M2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("B3:L32").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlCenter
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("I3:K32").Select
Selection.Font.Bold = True
Range("K3").Select
ActiveCell.FormulaR1C1 = "=SUM(RC[-2]:RC[-1])"
Range("K3").Select
Selection.AutoFill Destination:=Range("K3:K32"), Type:=xlFillDefault
Range("K3:K32").Select
Range("K33").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-30]C:R[-1]C)"
Range("J33:K33").Select
Range("K33").Activate
Selection.Font.Size = 12
Selection.Font.Size = 14
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Font.Bold = True
ActiveWindow.SmallScroll Down:=-30
Range("A1:M1").Select
Sheets("Sayfa2").Select
Sheets("Sayfa2").Name = "İEP MALİYET TABLOSU"
Sheets("ÖDENEK İSTEM TABLOSU").Select
Columns("Q:AF").Select
Range("Q2").Activate
Selection.Delete Shift:=xlToLeft
Range("A1:O9").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A10:G16").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("A17:L23").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=-24
Range("B1:O1").Select
Application.CutCopyMode = False
ChDir "C:\Users\Mehmet KARAKAŞ\Desktop"
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\Mehmet KARAKAŞ\Desktop\İEP ÖDENEK TABLOSU.xlsx", FileFormat:= _
xlOpenXMLWorkbook, CreateBackup:=False
Windows("2017 - Tekli Otomasyon (v.4).xlsm").Activate
Range("Q1:R1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWorkbook.Save
End Sub
Son düzenleme: