er det ikke nemmere at indspille en ny? syntes det ser forvirrende ud. mangler lidt grundlæggende om de her makroer. ??
' Indhold:
' Sub IndsætFormlerIPRIMOTAL(Ark As Worksheet)
' Sub IndsaetSumFormler(SumArk As Worksheet, SumKolonne As Integer, KontoKolonne As Integer)
' Sub IndsaetFormler()
' Sub IndlaesKontiIArray(Ark As Worksheet)
Public Konto() As String
Public Kontotype() As Integer
Sub IndsætFormlerIPRIMOTAL(ark As Worksheet)
If Not DebugMode Then Call MakroStart(True)
On Error GoTo AfslutMedFejl
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
' Formel til PRIMOTAL
Cells(ActiveCell.Row, 5).Select
ActiveCell.FormulaR1C1 = "=IF(RC[-4]<>"""",SUMIF(Liste_Primovaerdier,RC[-4],Liste_Primovaerdier),0)"
' Værdi til Tidligere Kladder
Cells(ActiveCell.Row, 7).Select
ActiveCell.Value = 0
' Formel til Denne Kladde
Cells(ActiveCell.Row, 9).Select
ActiveCell.FormulaR1C1 = "='Data 3'!R[-5]C[-1]*-1"
' Formel til Total
Cells(ActiveCell.Row, 11).Select
ActiveCell.FormulaR1C1 = "=SUM(RC[-6]:RC[-1])"
GoTo Afslut
AfslutMedFejl:
Application.StatusBar = Err.Number & ", " & Err.Description
Afslut:
Application.Calculate
Application.Calculation = xlCalculationAutomatic
End Sub
Sub IndlaesKontiIArray(ark As Worksheet)
If Not DebugMode Then Call MakroStart(True)
On Error GoTo AfslutMedFejl
Application.ScreenUpdating = False
Dim SidsteRaekke As Integer
tempSidsteRaekke = LastRow(ark) + 1
ReDim Konto(tempSidsteRaekke)
ReDim Kontotype(tempSidsteRaekke)
For x = 5 To tempSidsteRaekke
Konto(x) = ark.Cells(x, 1).Value
Kontotype(x) = ark.Cells(x, 6).Value
Next x
GoTo Afslut
AfslutMedFejl:
Application.StatusBar = Err.Number & ", " & Err.Description
Afslut:
Application.Calculate
Application.Calculation = xlCalculationAutomatic
End Sub
Sub IndsaetSumFormler(SumArk As Worksheet, SumKolonne As Integer, KontoKolonne As Integer)
If Not DebugMode Then Call MakroStart(True)
On Error GoTo AfslutMedFejl
' Application.ScreenUpdating = False
SidsteRaekke = LastRow(ActiveSheet)
Call IndlaesKontiIArray(Worksheets("Kontoplan"))
For x = 5 To SidsteRaekke
If Cells(x, KontoKolonne).Value <> "" Then
y = x