Dim antalRæk Const sats1 = 100 'kan ændres efter behov Const sats2 = 50 '-"- Public Sub beregning() Application.ScreenUpdating = False
Rem find antal rækker antalRæk = ActiveCell.SpecialCells(xlLastCell).Row
Rem gennemløb at rækker - find om TOTAL i kolonne A For ræk = 1 To antalRæk indhold = Cells(ræk, 1) Rem findes ordet "total" i cellen If InStr(LCase(indhold), "total") > 0 Then Rem indsæt formel i kolonne G (7) & I (9) Cells(ræk, 7).Formula = "=F" & CStr(ræk) & "*" & CStr(sats1) Cells(ræk, 9).Formula = "=H" & CStr(ræk) & "*" & CStr(sats2) End If Next ræk
Rem Tilpas kolonne-bredde Columns.AutoFit
Application.ScreenUpdating = True
MsgBox ("Beregning afsluttet") End Sub Private Sub CommandButton1_Click() beregning End Sub
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.