Hjælp til forståelse
Hej,Jeg har fundet frem til denne kode vha mange google søgninger og den virker på mit system, men mit problem er, at jeg ikke rigtig ved, hvad det er jeg gør. Er der nogen, der kan hjælpe?
lrow = tmpsh.Cells(Rows.Count, 1).End(xlUp).row
dRow = 2
tmpsh.Cells(2, 3).Formula = "=CountIf(Base!A:A,A2)"
tmpsh.Cells(2, 3).Copy Destination:=tmpsh.Range("C3:C" & lrow)
i = 2
While tmpsh.Cells(i, 1) <> ""
If (tmpsh.Cells(i, 3) > 7 And tmpsh.Cells(i, 2) = "Master") Or (tmpsh.Cells(i, 3) > 1 And tmpsh.Cells(i, 2) = "Bachelor") Then
dsh.Cells(dRow, 1) = tmpsh.Cells(i, 1)
dRow = dRow + 1
End If
i = i + 1
Wend
tmpsh.Delete
dsh.Activate
For i = 2 To dRow - 1
dsh.Cells(i, 2).FormulaArray = "=OFFSET(Base!A1,SMALL(IF((Base!A:A)=A" & i & "*(Base!M:M=MAXIFS(Base!M:M,Base!A:A,A" & i & ")),ROW(Base!M:M),""""),1)-1,1,1,1)"
dsh.Cells(i, 3).FormulaArray = "=OFFSET(Base!A1,SMALL(IF((Base!A:A)=A" & i & "*(Base!M:M=MAXIFS(Base!M:M,Base!A:A,A" & i & ")),ROW(Base!M:M),""""),1)-1,3,1,1)"
dsh.Cells(i, 4).FormulaArray = "=OFFSET(Base!A1,SMALL(IF((Base!A:A)=A" & i & "*(Base!M:M=MAXIFS(Base!M:M,Base!A:A,A" & i & ")),ROW(Base!M:M),""""),1)-1,4,1,1)"
dsh.Cells(i, 5).FormulaArray = "=OFFSET(Base!A1,SMALL(IF((Base!A:A)=A" & i & "*(Base!M:M=MAXIFS(Base!M:M,Base!A:A,A" & i & ")),ROW(Base!M:M),""""),1)-1,6,1,1)"
dsh.Cells(i, 6).FormulaArray = "=OFFSET(Base!A1,SMALL(IF((Base!A:A)=A" & i & "*(Base!M:M=MAXIFS(Base!M:M,Base!A:A,A" & i & ")),ROW(Base!M:M),""""),1)-1,7,1,1)"
dsh.Cells(i, 7).FormulaArray = "=OFFSET(Base!A1,SMALL(IF((Base!A:A)=A" & i & "*(Base!M:M=MAXIFS(Base!M:M,Base!A:A,A" & i & ")),ROW(Base!M:M),""""),1)-1,8,1,1)"
DoEvents
dsh.Cells(i, 4).Value = GetSemesterFromErollPeriod(dsh.Cells(i, 4).Value)
Next i
dsh.Columns("A:G").AutoFit
dsh.Range("A1:G" & dRow).Copy
dsh.Range("A1:G" & dRow).PasteSpecial xlValues