majesteleri
New Member
- Joined
- Aug 18, 2023
- Messages
- 2
- Office Version
- 2019
- Platform
- Windows
Hi everybody,
I'm trying to write a code. I want to insert a formula into the cell, but I get an error "Runtime error 1004"
I tried everything but couldnt find where the problem is.
error row is : ActiveCell.Formula = "=SUMPRODUCT(" & strRange1 & ")"
Pls help me.
I'm trying to write a code. I want to insert a formula into the cell, but I get an error "Runtime error 1004"
I tried everything but couldnt find where the problem is.
error row is : ActiveCell.Formula = "=SUMPRODUCT(" & strRange1 & ")"
Pls help me.
VBA Code:
Sub KOFormulDuzenle()
'
' KOFormulDuzenle Makro
'
'
Application.ScreenUpdating = False
Dim TLTOPLAMLAR As Integer
Dim TCFormul As String
Dim strRange1 as String
ActiveWorkbook.Sheets("Keşif Özeti").Select
firmasayisi = Range("A1").Value
Cells.Find(What:="Sıra" & Chr(10) & "No", After:=ActiveCell, LookIn:=xlFormulas2, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
kesifilksatir = ActiveCell.Row + 1
Cells.Find(What:="TL TOPLAMLAR", After:=ActiveCell, LookIn:=xlFormulas2, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
TLTOPLAMLAR = ActiveCell.Row
Range("A5").Select
Cells.Find(What:="Kur", After:=ActiveCell, LookIn:=xlFormulas2, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Kur = ActiveCell.Column
Cells.Find(What:="Miktar", After:=ActiveCell, LookIn:=xlFormulas2, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Miktarsutun = ActiveCell.Column
kesifsatirsayisi = kesifsonsatir - kesifilksatir
For i = 0 To 4
Range("A5").Select
Cells.Find(What:="Malzeme" & Chr(10) & "Birim Fiyatı", After:=ActiveCell, LookIn:=xlFormulas2, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
MBF = ActiveCell.Column
strRange1 = Chr(64 + Miktarsutun) & kesifilksatir & ":" & Chr(64 + Miktarsutun) & TLTOPLAMLAR - 1 & ";" & Chr(64 + Kur) & kesifilksatir & ":" & Chr(64 + Kur) & TLTOPLAMLAR - 1 & ";" & Chr(64 + MBF + i) & kesifilksatir & ":" & Chr(64 + MBF + i) & TLTOPLAMLAR - 1
strRange2 = Chr(64 + MBF + i) & TLTOPLAMLAR
TCFormul = "=SUMPRODUCT(" & strRange1 & ")"
Range(strRange2).Select
ActiveCell.Formula = "=SUMPRODUCT(" & strRange1 & ")"
Next i
End Sub