Merhabalar,
Excelim 3 sayfadan oluşuyor. Aynı sayfada yada sayfalar arasında düşeyara, çok etopla, birleştir gibi formülleri kullanıyorum. Örneğin formül [A2:A65536]*[B2:B65536]=[C2:C65536] ise makro a ve b değişkenine bağlı olarak formül gibi hesaplama yapsın, boşlarsa yapmasın... Amacım; excel satır sayım fazla olduğundan dolayı dosya boyutu ve kasmalardan kurtulmak için formüllerden makroya geçmektir.
Alttaki kodlarda yeşil olanlar çalışıyor, kırmızı olanlar çalışmıyor. Çözüm ve yönlendirme için yol gösterir misiniz.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo son
Set ws1 = Worksheets("Gelen")
Set ws2 = Worksheets("İmalat")
If Intersect(Target, Range([P2: P65536], [Q2:Q65536])) Is Nothing Then Exit Sub
If Target <> "" Then
Cells(Target.Row, "R") = Cells(Target.Row, "P") * Cells(Target.Row, "Q")
Else
Cells(Target.Row, "R") = Empty
End If
If Intersect(Target, Range([P2: P65536], [T2:T65536])) Is Nothing Then Exit Sub
If Target <> "" Then
Cells(Target.Row, "U") = Cells(Target.Row, "P") * Cells(Target.Row, "T")
Else
Cells(Target.Row, "U") = Empty
End If
If Intersect(Target, Range([A2:A65536], [M2:M65536])) Is Nothing Then Exit Sub
If Target <> "" Then
Cells(sat, "V") = Cells(sat, "A") & Cells(sat, "M")
Else
Cells(sat, "V") = Empty
End If
If Intersect(Target, Range([A2:A65536], [P2: P65536])) Is Nothing Then Exit Sub
If Target <> "" Then
Cells(Target.Row, "W") = WorksheetFunction.SumIf([A2:A65536], Cells(Target.Row, "A"), [P2: P65536])
Else
Cells(Target.Row, "W") = Empty
End If
If Intersect(Target, Range([A2:A65536], ws2.[I2:I65536])) Is Nothing Then Exit Sub
If Target <> "" Then
Cells(Target.Row, "X") = WorksheetFunction.SumIf(ws2.[A2:A65536], Cells(Target.Row, "A"), ws2.[I2:I65536])
Else
Cells(Target.Row, "X") = Empty
End If
If Intersect(Target, Range([W2:W65536], [X2:X65536])) Is Nothing Then Exit Sub
If Target <> "" Then
Cells(Target.Row, "Y") = Cells(Target.Row, "W") - Cells(Target.Row, "X")
Else
Cells(Target.Row, "Y") = Empty
End If
If Intersect(Target, Range([A2:A65536], [Y2:Y65536])) Is Nothing Then Exit Sub
If Cells(Target.Row, "Y") <> 0 Then
Cells(Target.Row, "Z") = Cells(Target.Row, "M")
Else
Cells(Target.Row, "Z") = Empty
End If
son:
End Sub
Saygılar
Excelim 3 sayfadan oluşuyor. Aynı sayfada yada sayfalar arasında düşeyara, çok etopla, birleştir gibi formülleri kullanıyorum. Örneğin formül [A2:A65536]*[B2:B65536]=[C2:C65536] ise makro a ve b değişkenine bağlı olarak formül gibi hesaplama yapsın, boşlarsa yapmasın... Amacım; excel satır sayım fazla olduğundan dolayı dosya boyutu ve kasmalardan kurtulmak için formüllerden makroya geçmektir.
Alttaki kodlarda yeşil olanlar çalışıyor, kırmızı olanlar çalışmıyor. Çözüm ve yönlendirme için yol gösterir misiniz.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo son
Set ws1 = Worksheets("Gelen")
Set ws2 = Worksheets("İmalat")
If Intersect(Target, Range([P2: P65536], [Q2:Q65536])) Is Nothing Then Exit Sub
If Target <> "" Then
Cells(Target.Row, "R") = Cells(Target.Row, "P") * Cells(Target.Row, "Q")
Else
Cells(Target.Row, "R") = Empty
End If
If Intersect(Target, Range([P2: P65536], [T2:T65536])) Is Nothing Then Exit Sub
If Target <> "" Then
Cells(Target.Row, "U") = Cells(Target.Row, "P") * Cells(Target.Row, "T")
Else
Cells(Target.Row, "U") = Empty
End If
If Intersect(Target, Range([A2:A65536], [M2:M65536])) Is Nothing Then Exit Sub
If Target <> "" Then
Cells(sat, "V") = Cells(sat, "A") & Cells(sat, "M")
Else
Cells(sat, "V") = Empty
End If
If Intersect(Target, Range([A2:A65536], [P2: P65536])) Is Nothing Then Exit Sub
If Target <> "" Then
Cells(Target.Row, "W") = WorksheetFunction.SumIf([A2:A65536], Cells(Target.Row, "A"), [P2: P65536])
Else
Cells(Target.Row, "W") = Empty
End If
If Intersect(Target, Range([A2:A65536], ws2.[I2:I65536])) Is Nothing Then Exit Sub
If Target <> "" Then
Cells(Target.Row, "X") = WorksheetFunction.SumIf(ws2.[A2:A65536], Cells(Target.Row, "A"), ws2.[I2:I65536])
Else
Cells(Target.Row, "X") = Empty
End If
If Intersect(Target, Range([W2:W65536], [X2:X65536])) Is Nothing Then Exit Sub
If Target <> "" Then
Cells(Target.Row, "Y") = Cells(Target.Row, "W") - Cells(Target.Row, "X")
Else
Cells(Target.Row, "Y") = Empty
End If
If Intersect(Target, Range([A2:A65536], [Y2:Y65536])) Is Nothing Then Exit Sub
If Cells(Target.Row, "Y") <> 0 Then
Cells(Target.Row, "Z") = Cells(Target.Row, "M")
Else
Cells(Target.Row, "Z") = Empty
End If
son:
End Sub
Saygılar