- Katılım
- 14 Kasım 2017
- Mesajlar
- 618
- Excel Vers. ve Dili
- 2010 Türkçe
- Altın Üyelik Bitiş Tarihi
- 07-01-2024
Arkadaşlar 370 tane sayfayı ilgilendiren bir makro kodu yazmam gerekiyor. Aşağıdaki kod 10 sayfa için yazılmış olmasına rağmen oldukça uzun ben bunu 370 sayfaya kadar yazmaya devam edersem çok fazla uzun bir kod ortaya çıkacak bunun daha kısa bir yolu var mıdır acaba ? Yardımlarınızı bekliyorum.
Kod:
Sub Kaydet()
'
' Kaydet Makro
'
'
If MsgBox("Uyarı! Yanlış tarih girilmesi bazı raporların silinmesine neden olabilir. Devam edilsin mi?", vbYesNo) = vbNo Then Exit Sub
' Sayfa 1
Sheets("Veri").Visible = True
Sheets("Veri").Select
If Range("Z3") = 1 Then
Range("P9:X26").Copy
Sheets("1").Select
Range("N14:V31").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Veri").Select
Range("Q3:T3").Copy
Sheets("1").Select
Range("O8:R8").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Veri").Select
Range("V3:X3").Copy
Range("AB3").Select
Sheets("1").Select
Range("T8:V8").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("C14").Select
Application.CutCopyMode = False
Sheets("Veri").Visible = False
' Sayfa 2
ElseIf Range("Z3") = 2 Then
Sheets("Veri").Visible = True
Sheets("Veri").Select
Range("P9:X26").Copy
Sheets("2").Select
Range("N14:V31").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Veri").Select
Range("Q3:T3").Copy
Sheets("2").Select
Range("O8:R8").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Veri").Select
Range("V3:X3").Copy
Range("AB3").Select
Sheets("2").Select
Range("T8:V8").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("C14").Select
Application.CutCopyMode = False
Sheets("Veri").Visible = False
' Sayfa 3
ElseIf Range("Z3") = 3 Then
Sheets("Veri").Visible = True
Sheets("Veri").Select
Range("P9:X26").Copy
Sheets("3").Select
Range("N14:V31").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Veri").Select
Range("Q3:T3").Copy
Sheets("3").Select
Range("O8:R8").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Veri").Select
Range("V3:X3").Copy
Range("AB3").Select
Sheets("3").Select
Range("T8:V8").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("C14").Select
Application.CutCopyMode = False
Sheets("Veri").Visible = False
' Sayfa 4
ElseIf Range("Z3") = 4 Then
Sheets("Veri").Visible = True
Sheets("Veri").Select
Range("P9:X26").Copy
Sheets("4").Select
Range("N14:V31").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Veri").Select
Range("Q3:T3").Copy
Sheets("4").Select
Range("O8:R8").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Veri").Select
Range("V3:X3").Copy
Range("AB3").Select
Sheets("4").Select
Range("T8:V8").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("C14").Select
Application.CutCopyMode = False
Sheets("Veri").Visible = False
' Sayfa 5
ElseIf Range("Z3") = 5 Then
Sheets("Veri").Visible = True
Sheets("Veri").Select
Range("P9:X26").Copy
Sheets("5").Select
Range("N14:V31").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Veri").Select
Range("Q3:T3").Copy
Sheets("5").Select
Range("O8:R8").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Veri").Select
Range("V3:X3").Copy
Range("AB3").Select
Sheets("5").Select
Range("T8:V8").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("C14").Select
Application.CutCopyMode = False
Sheets("Veri").Visible = False
' Sayfa 6
ElseIf Range("Z3") = 6 Then
Sheets("Veri").Visible = True
Sheets("Veri").Select
Range("P9:X26").Copy
Sheets("6").Select
Range("N14:V31").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Veri").Select
Range("Q3:T3").Copy
Sheets("6").Select
Range("O8:R8").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Veri").Select
Range("V3:X3").Copy
Range("AB3").Select
Sheets("6").Select
Range("T8:V8").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("C14").Select
Application.CutCopyMode = False
Sheets("Veri").Visible = False
' Sayfa 7
ElseIf Range("Z3") = 7 Then
Sheets("Veri").Visible = True
Sheets("Veri").Select
Range("P9:X26").Copy
Sheets("7").Select
Range("N14:V31").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Veri").Select
Range("Q3:T3").Copy
Sheets("7").Select
Range("O8:R8").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Veri").Select
Range("V3:X3").Copy
Range("AB3").Select
Sheets("7").Select
Range("T8:V8").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("C14").Select
Application.CutCopyMode = False
Sheets("Veri").Visible = False
' Sayfa 8
ElseIf Range("Z3") = 8 Then
Sheets("Veri").Visible = True
Sheets("Veri").Select
Range("P9:X26").Copy
Sheets("8").Select
Range("N14:V31").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Veri").Select
Range("Q3:T3").Copy
Sheets("8").Select
Range("O8:R8").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Veri").Select
Range("V3:X3").Copy
Range("AB3").Select
Sheets("8").Select
Range("T8:V8").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("C14").Select
Application.CutCopyMode = False
Sheets("Veri").Visible = False
' Sayfa 9
ElseIf Range("Z3") = 9 Then
Sheets("Veri").Visible = True
Sheets("Veri").Select
Range("P9:X26").Copy
Sheets("9").Select
Range("N14:V31").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Veri").Select
Range("Q3:T3").Copy
Sheets("9").Select
Range("O8:R8").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Veri").Select
Range("V3:X3").Copy
Range("AB3").Select
Sheets("9").Select
Range("T8:V8").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("C14").Select
Application.CutCopyMode = False
Sheets("Veri").Visible = False
' Sayfa 10
ElseIf Range("Z3") = 10 Then
Sheets("Veri").Visible = True
Sheets("Veri").Select
Range("P9:X26").Copy
Sheets("10").Select
Range("N14:V31").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Veri").Select
Range("Q3:T3").Copy
Sheets("10").Select
Range("O8:R8").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Veri").Select
Range("V3:X3").Copy
Range("AB3").Select
Sheets("10").Select
Range("T8:V8").PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("C14").Select
Application.CutCopyMode = False
Sheets("Veri").Visible = False
Else
MsgBox "Yanlış tarih girildi."
End If
End Sub