irfancantr
Altın Üye
- Katılım
- 18 Haziran 2007
- Mesajlar
- 625
- Excel Vers. ve Dili
- Excel 365 - İmngilizce
DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Private Sub CommandButton1_Click()
Range("V5").Value = "1"
[COLOR=red][B]For i = 1 To 15
Range("W" & i * 2 + 2).Value = Controls("Textbox" & i).Value
Next
For i = 16 To 31
Range("W" & i * 2 + 5).Value = Controls("Textbox" & i).Value
Next[/B][/COLOR]
UserForm3.Hide
Calculate
UserForm3.Show
End Sub
Private Sub CommandButton2_Click()
UserForm3.Hide
UserForm2.Show
End Sub
Private Sub CommandButton3_Click()
UserForm3.Hide
Range("W4:W68").Select
Selection.ClearContents
Range("W4").Select
TextBox31.Value = ""
Calculate
UserForm3.Show
End Sub
Private Sub CheckBox1_Click()
On Error Resume Next
If CheckBox1 Then
CheckBox1.Caption = "Exceli Kapat"
Application.Visible = 1
Else
CheckBox1.Caption = "Exceli Aç"
Application.Visible = 0
End If
End Sub
Private Sub ComboBox11_Change()
ComboBox11.RowSource = "Veri!a1:a5000"
End Sub
Private Sub ComboBox12_Click()
Sheets(ComboBox12.Value).Select
End Sub
Private Sub ComboBox13_Click()
Sheets(ComboBox13.Value).Select
End Sub
Private Sub CommandButton1_Click()
UserForm2.Hide
End Sub
Private Sub CommandButton10_Click()
cevap = MsgBox("Bu dosyayının bir örneğini ''d:\YEDEK'' klasörü içine yedeklemek istiyor musunuz? ", vbYesNo)
If cevap = 6 Then
On Error Resume Next
Dim FSO As Object
Dim MyFolder, MyFile, MyFileEnd As String
Dim s As Long
MyFolder = "D:\YEDEK"
MyFile = "YEMEK MENÜ TASLAĞI"
MyFileEnd = MyFile & " " & Format(Now, "dd mm yyyy") & ".xls"
Set FSO = CreateObject("Scripting.FileSystemObject")
If Not FSO.FolderExists(MyFolder) Then
FSO.CreateFolder (MyFolder)
End If
ActiveWorkbook.SaveCopyAs Filename:=MyFolder & Application.PathSeparator & MyFileEnd
Set FSO = Nothing
Else
MsgBox "Yedek alınmadı..."
End If
End Sub
Private Sub CommandButton11_Click()
UserForm2.Hide
Dim MyStr As String, InfoMsg As String
Dim Rng1 As String, LookupValue As String
Dim MyQ As VbMsgBoxResult
Dim FoundRng As Variant
MyStr = Trim(Application.InputBox("Aranacak ürünü girin !", _
"Find exact match ..."))
If Not MyStr = "False" Then
Set FoundRng = Cells.Find(MyStr, LookIn:=xlValues, LookAt:=xlPart)
If Not FoundRng Is Nothing Then
Rng1 = FoundRng.Address
FoundRng.Activate
ResumeSub2:
If Right(FoundRng.Value, 1) <> " " Then LookupValue = FoundRng.Value & " "
MyData = Split(LookupValue, " ", , vbTextCompare)
For i = LBound(MyData) To UBound(MyData)
If MyData(i) = MyStr Then
InfoMsg = "Aranan metin " & FoundRng.Address(False, False) _
& " hücresinde bulundu." _
& vbCrLf & vbCrLf & "Bulunan hücrenin içeriği :" _
& vbCrLf & vbCrLf & FoundRng.Value & vbCrLf _
& vbCrLf & "Aramaya devam etmek istiyormusunuz ?"
MyQ = MsgBox(InfoMsg, vbInformation + vbYesNo, _
"Arama sonucu...")
If MyQ = vbYes Then GoTo ResumeSub1:
Exit Sub
End If
Next
Else
MsgBox "Aranan değer bulunamadı !", vbInformation, "Arama sonucu..."
Exit Sub
End If
ResumeSub1:
Set FoundRng = Cells.FindNext(FoundRng)
If Rng1 = FoundRng.Address Then
MsgBox "Aranan değerden başka bulunamadı !", vbInformation, _
"Arama sonucu..."
Exit Sub
End If
FoundRng.Activate
GoTo ResumeSub2:
End If
Set FoundRng = Nothing
End Sub
Private Sub CommandButton12_Click()
soru = MsgBox("Program Kapatılıyor...", vbYesNo, "Program Kapatılacak !")
If soru = 6 Then
UserForm2.Hide
Sheets("ANA SAYFA").Select
ActiveSheet.Unprotect "1"
Range("p1") = Range("p1") + 1
Range("c9").Select
ActiveSheet.Protect "1"
With Application
.Calculation = xlAutomatic
.MaxChange = 0.001
End With
Workbooks("YEMEK MENÜ TASLAĞI.XLS").Save
Application.Quit
Else
Exit Sub
End If
End Sub
Private Sub CommandButton13_Click()
UserForm2.Hide
Sheets("AYLIK MENÜ").Select
cevap = MsgBox("Örnek Menüde bulunan menüyü aktarmak üzeresiniz.Devam etmek istiyormusunuz?", vbYesNo)
If cevap = 6 Then
Application.ScreenUpdating = False
For i = 5 To 65 Step 2
Range("C" & i - 1 & ":J" & i - 1).FormulaR1C1 = "='ÖRNEK MENÜLER'!RC"
Range("C" & i).FormulaR1C1 = "=VLOOKUP(R[-1]C,C[30]:C[32],2,0)"
Range("D" & i).FormulaR1C1 = "Cal."
Range("E" & i).FormulaR1C1 = "=VLOOKUP(R[-1]C,C[31]:C[33],2,0)"
Range("F" & i).FormulaR1C1 = "Cal."
Range("G" & i).FormulaR1C1 = "=VLOOKUP(R[-1]C,C[32]:C[34],2,0)"
Range("H" & i).FormulaR1C1 = "Cal."
Range("I" & i).FormulaR1C1 = "=VLOOKUP(R[-1]C,C[33]:C[35],2,0)"
Range("J" & i).FormulaR1C1 = "Cal."
Range("K" & i - 1).FormulaR1C1 = "=R[1]C[-8]+R[1]C[-6]+R[1]C[-4]+R[1]C[-2]"
Range("L" & i - 1).FormulaR1C1 = "Cal."
Next
Range("K3").FormulaR1C1 = "TOP.CAL."
Calculate
With [C4:L65]
.Formula = .Value
End With
Else
End If
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton14_Click()
UserForm2.Hide
Sheets("AYLIK MENÜ").Select
cevap = MsgBox("Menü'yü temizlemekte emin misiniz?", vbYesNo)
If cevap = 6 Then
Application.ScreenUpdating = False
Range("C4:L65,O2:P65,K3,D70:H71").Select
Selection.ClearContents
Range("C4:D4").Select
Calculate
Application.ScreenUpdating = True
MsgBox "Menü temizlendi."
Else
MsgBox "Menü temizlenmedi."
End If
UserForm2.Show
End Sub
Private Sub CommandButton15_Click()
UserForm2.Hide
Sheets("AYLIK MENÜ").Select
Application.ScreenUpdating = False
For i = 5 To 65 Step 2
Range("C" & i).FormulaR1C1 = "=VLOOKUP(R[-1]C,C[30]:C[32],2,0)"
Range("D" & i).FormulaR1C1 = "Cal."
Range("E" & i).FormulaR1C1 = "=VLOOKUP(R[-1]C,C[31]:C[33],2,0)"
Range("F" & i).FormulaR1C1 = "Cal."
Range("G" & i).FormulaR1C1 = "=VLOOKUP(R[-1]C,C[32]:C[34],2,0)"
Range("H" & i).FormulaR1C1 = "Cal."
Range("I" & i).FormulaR1C1 = "=VLOOKUP(R[-1]C,C[33]:C[35],2,0)"
Range("J" & i).FormulaR1C1 = "Cal."
Range("K" & i - 1).FormulaR1C1 = "=R[1]C[-8]+R[1]C[-6]+R[1]C[-4]+R[1]C[-2]"
Range("L" & i - 1).FormulaR1C1 = "Cal."
Next
Range("K3").FormulaR1C1 = "TOP.CAL."
Calculate
With [C4:L65]
.Formula = .Value
End With
Range("O2:P65,D70:H71").Select
Selection.ClearContents
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton16_Click()
UserForm2.Hide
Sheets("AYLIK MENÜ").Select
Application.ScreenUpdating = False
For i = 5 To 65 Step 2
Range("C" & i).FormulaR1C1 = "FİYATI"
Range("D" & i).FormulaR1C1 = "=VLOOKUP(R[-1]C[-1],C[29]:C[31],3,0)"
Range("E" & i).FormulaR1C1 = "FİYATI"
Range("F" & i).FormulaR1C1 = "=VLOOKUP(R[-1]C[-1],C[30]:C[32],3,0)"
Range("G" & i).FormulaR1C1 = "FİYATI"
Range("H" & i).FormulaR1C1 = "=VLOOKUP(R[-1]C[-1],C[31]:C[33],3,0)"
Range("I" & i).FormulaR1C1 = "FİYATI"
Range("J" & i).FormulaR1C1 = "=VLOOKUP(R[-1]C[-1],C[32]:C[34],3,0)"
Range("K" & i - 1).FormulaR1C1 = "=R[1]C[-7]+R[1]C[-5]+R[1]C[-3]+R[1]C[-1]"
Range("L" & i - 1).FormulaR1C1 = "YTL"
Next
Range("K3").FormulaR1C1 = "TOP.FİYAT"
With [C4:L65]
.Formula = .Value
End With
Range("O2").FormulaR1C1 = "KİŞİ SAYILARI"
Range("P2").FormulaR1C1 = "TOPLAM FİYAT"
cevap = MsgBox("Kişi sayılarını Gün Gün girmek istermisiniz?", vbYesNo)
If cevap = 6 Then
aciklama = "LÜTFEN KİŞİ SAYISINI GİRİNİZ..."
For i = 4 To 64 Step 2
baslik = Range("B" & i).Value & " " & Range("B" & i + 1).Value
Range("O" & i).Value = InputBox(aciklama, baslik)
Range("P" & i).FormulaR1C1 = "=RC[-5]*RC[-1]"
Next
Else
End If
Calculate
With [P4:P65]
.Formula = .Value
End With
Range("D70").FormulaR1C1 = "TOPLAM BİR KİŞİ AYLIK YEMEK FİYATI"
Range("G70").FormulaR1C1 = "=SUM(R[-66]C[4]:R[-5]C[4])"
Range("H70").FormulaR1C1 = "YTL' dir."
Range("D71").FormulaR1C1 = "TOPLAM GENEL AYLIK YEMEK FİYATI"
Range("G71").FormulaR1C1 = "=SUM(R[-67]C[9]:R[-6]C[9])"
Range("H71").FormulaR1C1 = "YTL ' dir."
Calculate
With [D70:H71]
.Formula = .Value
End With
Application.ScreenUpdating = True
UserForm2.Show
End Sub
Private Sub CommandButton17_Click()
UserForm2.Hide
End Sub
Private Sub CommandButton18_Click()
UserForm2.Hide
Sheets("PİŞİRME FORMU").Select
cevap = MsgBox("Formu temizlemekte emin misiniz?", vbYesNo)
If cevap = 6 Then
Range("D8:R29,D31:R47").Select
Selection.ClearContents
Calculate
Range("D8").Select
Else
End If
UserForm2.Show
End Sub
Ben formu çalıştırdım Textboxlar girilen değerleri sayfaya aktardı.
Kodları kısaltmaya örnek olarak da Userform2 nin kodları aşağıda.
Kod:
Private Sub CommandButton1_Click()
Range("V5").Value = "1"
For i = 1 To 15
Range("W" & i * 2 + 2).Value = Controls("Textbox" & i).Value
Next
For i = 16 To 31
Range("W" & i * 2 + 6).Value = Controls("Textbox" & i).Value
Next
UserForm3.Hide
Calculate
UserForm3.Show
End Sub
Private Sub CommandButton2_Click()
UserForm3.Hide
UserForm2.Show
End Sub
Private Sub CommandButton3_Click()
UserForm3.Hide
Range("W4:W68").Select
Selection.ClearContents
Range("W4").Select
TextBox31.Value = ""
Calculate
UserForm3.Show
End Sub