Merhaba.
Aşağıdaki Kodları Worksheet_Change de yazınca çalışıyor Module ye yazınca çalışmıyor.
Worksheet de bir sütun değişince aşağıdaki Hesapla Makrosunun çalışmasını istiyorum.
Satr = Target.Cells.Row
Kodunu değişken olarak Worksheet_Change de kullanınca çalışıyor Module de sürekli hata veriyor. Kodları nasıl değiştirmem gerektiği konusunda yardımcı olabilir misiniz.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 3 Then
Call Hesapla
End If
End Sub
Sub Hesapla()
Satr = Target.Cells.Row '// Bu kod hata veriyor \\,
Cells(Satr, 5).Value = ""
Cells(Satr, 6).Value = ""
Cells(Satr, 7).Value = ""
Cells(Satr, 9).Value = ""
If Cells(Satr, 4).Value = 18 Then
Cells(Satr, 5).Value = (Cells(Satr, 3).Value / 1.18) * 0.18
Cells(Satr, 9).Value = Cells(Satr, 3).Value - Cells(Satr, 5) - Cells(Satr, 8)
ElseIf Cells(Satr, 4).Value = 8 Then
Cells(Satr, 6).Value = (Cells(Satr, 3).Value / 1.08) * 0.08
Cells(Satr, 9).Value = Cells(Satr, 3).Value - Cells(Satr, 6) - Cells(Satr, 8)
ElseIf Cells(Satr, 4).Value = 1 Then
Cells(Satr, 7).Value = (Cells(Satr, 3).Value / 1.01) * 0.01
Cells(Satr, 9).Value = Cells(Satr, 3).Value - Cells(Satr, 7) - Cells(Satr, 8)
ElseIf Cells(Satr, 4).Value = "" Then
Cells(Satr, 9).Value = Cells(Satr, 3).Value - Cells(Satr, 8)
End If
Cells(Satr, 5).Value = Round(Cells(Satr, 5), 2)
Cells(Satr, 6).Value = Round(Cells(Satr, 6), 2)
Cells(Satr, 7).Value = Round(Cells(Satr, 7), 2)
Cells(Satr, 8).Value = Round(Cells(Satr, 8), 2)
Cells(Satr, 9).Value = Round(Cells(Satr, 9), 2)
End Sub
Yardımlarınız için şimdiden Teşekkürler.
Aşağıdaki Kodları Worksheet_Change de yazınca çalışıyor Module ye yazınca çalışmıyor.
Worksheet de bir sütun değişince aşağıdaki Hesapla Makrosunun çalışmasını istiyorum.
Satr = Target.Cells.Row
Kodunu değişken olarak Worksheet_Change de kullanınca çalışıyor Module de sürekli hata veriyor. Kodları nasıl değiştirmem gerektiği konusunda yardımcı olabilir misiniz.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 3 Then
Call Hesapla
End If
End Sub
Sub Hesapla()
Satr = Target.Cells.Row '// Bu kod hata veriyor \\,
Cells(Satr, 5).Value = ""
Cells(Satr, 6).Value = ""
Cells(Satr, 7).Value = ""
Cells(Satr, 9).Value = ""
If Cells(Satr, 4).Value = 18 Then
Cells(Satr, 5).Value = (Cells(Satr, 3).Value / 1.18) * 0.18
Cells(Satr, 9).Value = Cells(Satr, 3).Value - Cells(Satr, 5) - Cells(Satr, 8)
ElseIf Cells(Satr, 4).Value = 8 Then
Cells(Satr, 6).Value = (Cells(Satr, 3).Value / 1.08) * 0.08
Cells(Satr, 9).Value = Cells(Satr, 3).Value - Cells(Satr, 6) - Cells(Satr, 8)
ElseIf Cells(Satr, 4).Value = 1 Then
Cells(Satr, 7).Value = (Cells(Satr, 3).Value / 1.01) * 0.01
Cells(Satr, 9).Value = Cells(Satr, 3).Value - Cells(Satr, 7) - Cells(Satr, 8)
ElseIf Cells(Satr, 4).Value = "" Then
Cells(Satr, 9).Value = Cells(Satr, 3).Value - Cells(Satr, 8)
End If
Cells(Satr, 5).Value = Round(Cells(Satr, 5), 2)
Cells(Satr, 6).Value = Round(Cells(Satr, 6), 2)
Cells(Satr, 7).Value = Round(Cells(Satr, 7), 2)
Cells(Satr, 8).Value = Round(Cells(Satr, 8), 2)
Cells(Satr, 9).Value = Round(Cells(Satr, 9), 2)
End Sub
Yardımlarınız için şimdiden Teşekkürler.
