- Katılım
- 25 Haziran 2023
- Mesajlar
- 100
- Excel Vers. ve Dili
- Microsoft Office 2019 / TR
Herkese iyi bayramlar arkadaslar
asagıda yazmıs oldugum IF makro koduna e ve f degıskenlerını ılave etmek ıstıyorum.
cari kod değişkeni e ve f degerıne esıt ıse sonucu "IHR" olarak gormesını ve asagıdaki IF blogunda birlestirme alanını bunun sonucunu baz alarak yapmasını ıstıyorum.
bırden fazla metot denedım ama hata aldım yardımcı olabılecek bırısı varmı
Sub Butce()
For i = 2 To Sheets("DATA").Range("AD2").End(xlDown).Row
Invoice_No = Cells(i, 5).Value
Department_Code = Cells(i, 29).Value
Description = Cells(i, 13).Value
Result_Left = Left(Ssp_Invoice_No, 3)
RESULT = Cells(i, 30).Value
Cari_Kod = Cells(i, 6).Value
a = "peynir"
b = "seker"
c = "lokum"
d = "pasta"
if_not = Result_Left & "-" & Department_Code
'e = 55987
'f = 56033
If Description = a Then
Cells(i, 30).Value = Result_Left & "-" & a
ElseIf Description = b Then
Cells(i, 30).Value = Result_Left & "-" & b
ElseIf Description = c Then
Cells(i, 30).Value = Result_Left & "-" & c
ElseIf Description = d Then
Cells(i, 30).Value = Result_Left & "-" & d
Else
Cells(i, 30).Value = if_not
End If
Next i
MsgBox ("Completed")
End Sub
asagıda yazmıs oldugum IF makro koduna e ve f degıskenlerını ılave etmek ıstıyorum.
cari kod değişkeni e ve f degerıne esıt ıse sonucu "IHR" olarak gormesını ve asagıdaki IF blogunda birlestirme alanını bunun sonucunu baz alarak yapmasını ıstıyorum.
bırden fazla metot denedım ama hata aldım yardımcı olabılecek bırısı varmı
Sub Butce()
For i = 2 To Sheets("DATA").Range("AD2").End(xlDown).Row
Invoice_No = Cells(i, 5).Value
Department_Code = Cells(i, 29).Value
Description = Cells(i, 13).Value
Result_Left = Left(Ssp_Invoice_No, 3)
RESULT = Cells(i, 30).Value
Cari_Kod = Cells(i, 6).Value
a = "peynir"
b = "seker"
c = "lokum"
d = "pasta"
if_not = Result_Left & "-" & Department_Code
'e = 55987
'f = 56033
If Description = a Then
Cells(i, 30).Value = Result_Left & "-" & a
ElseIf Description = b Then
Cells(i, 30).Value = Result_Left & "-" & b
ElseIf Description = c Then
Cells(i, 30).Value = Result_Left & "-" & c
ElseIf Description = d Then
Cells(i, 30).Value = Result_Left & "-" & d
Else
Cells(i, 30).Value = if_not
End If
Next i
MsgBox ("Completed")
End Sub