Just nu i M3-nätverket
Gå till innehåll

VSI7

Medlem
  • Antal inlägg

    14
  • Gick med

  • Senaste besök

  1. Kan man typ lägga som en om formel i makro form? =OM(D1>1;"modul1";"stop") med denna funktionen
  2. Nu fungerar formlerna som jag vill, så här ser de ut: Sub MyTask1(wsSource As Worksheet, wsTarget As Worksheet) Application.ScreenUpdating = False Range("F1:F300").Insert Shift:=xlToRight Range("F1").Value = Blad2.Range("B2").Value Range("F13").Value = Blad2.Range("M26").Value Range("F23").Value = Blad2.Range("B23").Value Range("F89").Value = Blad2.Range("H10").Value Range("F90").Value = Blad2.Range("H11").Value Range("F94").Value = Blad2.Range("K11").Value Range("F96").Value = Blad2.Range("M11").Value Range("F98").Value = Blad2.Range("O11").Value Range("F101").Value = Blad2.Range("R22").Value Range("F105").Value = Blad2.Range("H59").Value Range("F106").Value = Blad2.Range("H60").Value Range("F110").Value = Blad2.Range("H24").Value Range("F111").Value = Blad2.Range("H25").Value Range("F112").Value = Blad2.Range("H20").Value Range("F115").Value = Blad2.Range("K24").Value Range("F116").Value = Blad2.Range("K25").Value Range("F117").Value = Blad2.Range("K26").Value Range("F120").Value = Blad2.Range("O11").Value Range("F127").Value = Blad2.Range("H8").Value Range("F129").Value = Blad2.Range("K12").Value Range("F131").Value = Blad2.Range("M8").Value Range("F134").Value = Blad2.Range("O8").Value Range("F136").Value = Blad2.Range("H9").Value Range("F138").Value = Blad2.Range("H13").Value Range("F141").Value = Blad2.Range("K13").Value Range("F145").Value = Blad2.Range("M13").Value Range("F148").Value = Blad2.Range("O13").Value Range("F151").Value = Blad2.Range("H14").Value Range("F152").Value = Blad2.Range("H15").Value Range("F155").Value = Blad2.Range("K14").Value Range("F163").Value = Blad2.Range("R27").Value Range("F167").Value = Blad2.Range("H16").Value Range("F170").Value = Blad2.Range("H17").Value Range("F172").Value = Blad2.Range("H28").Value Range("F175").Value = Blad2.Range("R30").Value Range("F176").Value = Blad2.Range("R31").Value Range("F182").Value = Blad2.Range("H61").Value Range("F183").Value = Blad2.Range("R33").Value Range("F185").Value = Blad2.Range("R34").Value Range("F187").Value = Blad2.Range("R35").Value Range("F189").Value = Blad2.Range("H33").Value Range("F190").Value = Blad2.Range("H34").Value Range("F191").Value = Blad2.Range("H35").Value Range("F192").Value = Blad2.Range("H36").Value Range("F193").Value = Blad2.Range("H37").Value Range("F194").Value = Blad2.Range("H38").Value Range("F195").Value = Blad2.Range("H39").Value Range("F196").Value = Blad2.Range("H40").Value Range("F199").Value = Blad2.Range("H41").Value Range("F200").Value = Blad2.Range("H42").Value Range("F201").Value = Blad2.Range("H43").Value Range("F203").Value = Blad2.Range("K28").Value Range("F206").Value = Blad2.Range("M19").Value Range("F227").Value = Blad2.Range("H45").Value Range("F229").Value = Blad2.Range("H46").Value Range("F231").Value = Blad2.Range("H47").Value Range("F233").Value = Blad2.Range("H45").Value Range("F235").Value = Blad2.Range("H51").Value Range("F236").Value = Blad2.Range("H52").Value Range("F237").Value = Blad2.Range("H53").Value Range("F238").Value = Blad2.Range("H54").Value Range("F239").Value = Blad2.Range("H55").Value Range("F241").Value = Blad2.Range("H57").Value Range("F247").Value = Blad2.Range("H57").Value Range("F249").Value = Blad2.Range("O17").Value Range("F252").Value = Blad2.Range("O18").Value Range("F255").Value = Blad2.Range("O19").Value Range("F256").Value = Blad2.Range("O20").Value Range("F257").Value = Blad2.Range("O21").Value Range("F258").Value = Blad2.Range("O22").Value Range("F264").Value = Blad2.Range("O17").Value Range("F13").Value = "=SUM(RC[2]:RC[196])" Range("C23").Value = "=SUM(RC[2]:RC[196])" Range("C89").Value = "=SUM(RC[2]:RC[196])" Range("C90").Value = "=SUM(RC[2]:RC[196])" Range("C94").Value = "=SUM(RC[2]:RC[196])" Range("C96").Value = "=SUM(RC[2]:RC[196])" Range("C98").Value = "=SUM(RC[2]:RC[196])" Range("C101").Value = "=SUM(RC[2]:RC[196])" Range("C105").Value = "=SUM(RC[2]:RC[196])" Range("C106").Value = "=SUM(RC[2]:RC[196])" Range("C110").Value = "=SUM(RC[2]:RC[196])" Range("C111").Value = "=SUM(RC[2]:RC[196])" Range("C112").Value = "=SUM(RC[2]:RC[196])" Range("C115").Value = "=SUM(RC[2]:RC[196])" Range("C116").Value = "=SUM(RC[2]:RC[196])" Range("C117").Value = "=SUM(RC[2]:RC[196])" Range("C120").Value = "=SUM(RC[2]:RC[196])" Range("C127").Value = "=SUM(RC[2]:RC[196])" Range("C129").Value = "=SUM(RC[2]:RC[196])" Range("C131").Value = "=SUM(RC[2]:RC[196])" Range("C134").Value = "=SUM(RC[2]:RC[196])" Range("C136").Value = "=SUM(RC[2]:RC[196])" Range("C138").Value = "=SUM(RC[2]:RC[196])" Range("C141").Value = "=SUM(RC[2]:RC[196])" Range("C145").Value = "=SUM(RC[2]:RC[196])" Range("C148").Value = "=SUM(RC[2]:RC[196])" Range("C151").Value = "=SUM(RC[2]:RC[196])" Range("C152").Value = "=SUM(RC[2]:RC[196])" Range("C155").Value = "=SUM(RC[2]:RC[196])" Range("C163").Value = "=SUM(RC[2]:RC[196])" Range("C167").Value = "=SUM(RC[2]:RC[196])" Range("C170").Value = "=SUM(RC[2]:RC[196])" Range("C172").Value = "=SUM(RC[2]:RC[196])" Range("C175").Value = "=SUM(RC[2]:RC[196])" Range("C176").Value = "=SUM(RC[2]:RC[196])" Range("C182").Value = "=SUM(RC[2]:RC[196])" Range("C183").Value = "=SUM(RC[2]:RC[196])" Range("C185").Value = "=SUM(RC[2]:RC[196])" Range("C187").Value = "=SUM(RC[2]:RC[196])" Range("C189").Value = "=SUM(RC[2]:RC[196])" Range("C190").Value = "=SUM(RC[2]:RC[196])" Range("C191").Value = "=SUM(RC[2]:RC[196])" Range("C192").Value = "=SUM(RC[2]:RC[196])" Range("C193").Value = "=SUM(RC[2]:RC[196])" Range("C194").Value = "=SUM(RC[2]:RC[196])" Range("C195").Value = "=SUM(RC[2]:RC[196])" Range("C196").Value = "=SUM(RC[2]:RC[196])" Range("C199").Value = "=SUM(RC[2]:RC[196])" Range("C200").Value = "=SUM(RC[2]:RC[196])" Range("C201").Value = "=SUM(RC[2]:RC[196])" Range("C203").Value = "=SUM(RC[2]:RC[196])" Range("C206").Value = "=SUM(RC[2]:RC[196])" Range("C227").Value = "=SUM(RC[2]:RC[196])" Range("C229").Value = "=SUM(RC[2]:RC[196])" Range("C231").Value = "=SUM(RC[2]:RC[196])" Range("C233").Value = "=SUM(RC[2]:RC[196])" Range("C235").Value = "=SUM(RC[2]:RC[196])" Range("C236").Value = "=SUM(RC[2]:RC[196])" Range("C237").Value = "=SUM(RC[2]:RC[196])" Range("C238").Value = "=SUM(RC[2]:RC[196])" Range("C239").Value = "=SUM(RC[2]:RC[196])" Range("C241").Value = "=SUM(RC[2]:RC[196])" Range("F247").Value = "=SUM(RC[2]:RC[196])" Range("C249").Value = "=SUM(RC[2]:RC[196])" Range("C252").Value = "=SUM(RC[2]:RC[196])" Range("C255").Value = "=SUM(RC[2]:RC[196])" Range("C256").Value = "=SUM(RC[2]:RC[196])" Range("C257").Value = "=SUM(RC[2]:RC[196])" Range("C258").Value = "=SUM(RC[2]:RC[196])" Range("C264").Value = "=SUM(RC[2]:RC[196])" Range("C1").Select Application.ScreenUpdating = True End Sub Sub MyTask2(wsSource As Worksheet, wsTarget As Worksheet) Blad1.Range("c1:c50").Value = Blad3.Range("d1:d50").Value Blad3.Range("C1:C50").Delete Shift:=xlToLeft Cells.Select Blad1.Select Application.ScreenUpdating = True End Sub Sub MyTaskStarter15() Blad4.Select Modul1.MyTask1 Blad2, Blad4 Modul2.MyTask2 Blad2, ActiveSheet End Sub De jag funderar på nu är fortfarande om de går att fixa så makrot körs tills datan på blad3 är slut. med bara ett klick, den sak alltså upprepa macrot 10-100 gånger beroenda av hur mycket data de är i blad3
  3. Jag tror att jag förstått hur de fungerar, får den att räkna rätt men den "droppar" datan på fel blad... jag vill kunna ha blad1 uppe men plasera datan på worksheets("13") blad6... hur fixar jag till de? Sub MyTaskStarter() Modul6.MyTask Worksheets("Formler"), Worksheets("13") End Sub
  4. Nu fungerar formeln så som jag vill tillslut Anledningen till att jag inte har med fliknamn överallt är att jag ska använda ett likadant makro till flera flikar. Monshi, jag är inte tillräckligt bra på detta för att förstå hur jag ska använda de du skriver men fick nytta av Application.Screenupdating=false så här blev koden nu: Sub område15() ' ' ' område15 Makro ' ' Application.ScreenUpdating = False Sheets("15").Select Range("F1:F300").Insert Shift:=xlToRight Range("F1").Value = Sheets("Formler").Range("B2").Value Range("F23").Value = Sheets("Formler").Range("B23").Value Range("F89").Value = Sheets("Formler").Range("H10").Value Range("F90").Value = Sheets("Formler").Range("H11").Value Range("F94").Value = Sheets("Formler").Range("K11").Value Range("F98").Value = Sheets("Formler").Range("M11").Value Range("F106").Value = Sheets("Formler").Range("H60").Value Range("F110").Value = Sheets("Formler").Range("H24").Value Range("F111").Value = Sheets("Formler").Range("H25").Value Range("F112").Value = Sheets("Formler").Range("H20").Value Range("F115").Value = Sheets("Formler").Range("K24").Value Range("F116").Value = Sheets("Formler").Range("K25").Value Range("F117").Value = Sheets("Formler").Range("K26").Value Range("F120").Value = Sheets("Formler").Range("O11").Value Range("F127").Value = Sheets("Formler").Range("H8").Value Range("F129").Value = Sheets("Formler").Range("K12").Value Range("F131").Value = Sheets("Formler").Range("M8").Value Range("F134").Value = Sheets("Formler").Range("O8").Value Range("F136").Value = Sheets("Formler").Range("H9").Value Range("F138").Value = Sheets("Formler").Range("H13").Value Range("F141").Value = Sheets("Formler").Range("K13").Value Range("F145").Value = Sheets("Formler").Range("M13").Value Range("F148").Value = Sheets("Formler").Range("O13").Value Range("F151").Value = Sheets("Formler").Range("H14").Value Range("F152").Value = Sheets("Formler").Range("H15").Value Range("F155").Value = Sheets("Formler").Range("K14").Value Range("F163").Value = Sheets("Formler").Range("R27").Value Range("F167").Value = Sheets("Formler").Range("H16").Value Range("F170").Value = Sheets("Formler").Range("H17").Value Range("F172").Value = Sheets("Formler").Range("H28").Value Range("F175").Value = Sheets("Formler").Range("R30").Value Range("F176").Value = Sheets("Formler").Range("R31").Value Range("F182").Value = Sheets("Formler").Range("H61").Value Range("F185").Value = Sheets("Formler").Range("R34").Value Range("F187").Value = Sheets("Formler").Range("R36").Value Range("F189").Value = Sheets("Formler").Range("H33").Value Range("F190").Value = Sheets("Formler").Range("H34").Value Range("F191").Value = Sheets("Formler").Range("H35").Value Range("F192").Value = Sheets("Formler").Range("H36").Value Range("F193").Value = Sheets("Formler").Range("H37").Value Range("F194").Value = Sheets("Formler").Range("H38").Value Range("F195").Value = Sheets("Formler").Range("H39").Value Range("F196").Value = Sheets("Formler").Range("H40").Value Range("F199").Value = Sheets("Formler").Range("H41").Value Range("F200").Value = Sheets("Formler").Range("H42").Value Range("F201").Value = Sheets("Formler").Range("H43").Value Range("F203").Value = Sheets("Formler").Range("K28").Value Range("F206").Value = Sheets("Formler").Range("M19").Value Range("F227").Value = Sheets("Formler").Range("H45").Value Range("F229").Value = Sheets("Formler").Range("H46").Value Range("F231").Value = Sheets("Formler").Range("H47").Value Range("F233").Value = Sheets("Formler").Range("H45").Value Range("F235").Value = Sheets("Formler").Range("H51").Value Range("F236").Value = Sheets("Formler").Range("H52").Value Range("F237").Value = Sheets("Formler").Range("H53").Value Range("F238").Value = Sheets("Formler").Range("H54").Value Range("F239").Value = Sheets("Formler").Range("H55").Value Range("F241").Value = Sheets("Formler").Range("H57").Value Range("F249").Value = Sheets("Formler").Range("O17").Value Range("F252").Value = Sheets("Formler").Range("O18").Value Range("F255").Value = Sheets("Formler").Range("O19").Value Range("F256").Value = Sheets("Formler").Range("O20").Value Range("F257").Value = Sheets("Formler").Range("O21").Value Range("F258").Value = Sheets("Formler").Range("O22").Value Range("F264").Value = Sheets("Formler").Range("O17").Value Range("C23").Value = "=SUM(RC[2]:RC[196])" Range("C89").Value = "=SUM(RC[2]:RC[196])" Range("C90").Value = "=SUM(RC[2]:RC[196])" Range("C94").Value = "=SUM(RC[2]:RC[196])" Range("C98").Value = "=SUM(RC[2]:RC[196])" Range("C106").Value = "=SUM(RC[2]:RC[196])" Range("C110").Value = "=SUM(RC[2]:RC[196])" Range("C111").Value = "=SUM(RC[2]:RC[196])" Range("C112").Value = "=SUM(RC[2]:RC[196])" Range("C115").Value = "=SUM(RC[2]:RC[196])" Range("C116").Value = "=SUM(RC[2]:RC[196])" Range("C117").Value = "=SUM(RC[2]:RC[196])" Range("C120").Value = "=SUM(RC[2]:RC[196])" Range("C127").Value = "=SUM(RC[2]:RC[196])" Range("C129").Value = "=SUM(RC[2]:RC[196])" Range("C131").Value = "=SUM(RC[2]:RC[196])" Range("C134").Value = "=SUM(RC[2]:RC[196])" Range("C136").Value = "=SUM(RC[2]:RC[196])" Range("C138").Value = "=SUM(RC[2]:RC[196])" Range("C141").Value = "=SUM(RC[2]:RC[196])" Range("C145").Value = "=SUM(RC[2]:RC[196])" Range("C148").Value = "=SUM(RC[2]:RC[196])" Range("C151").Value = "=SUM(RC[2]:RC[196])" Range("C152").Value = "=SUM(RC[2]:RC[196])" Range("C155").Value = "=SUM(RC[2]:RC[196])" Range("C163").Value = "=SUM(RC[2]:RC[196])" Range("C167").Value = "=SUM(RC[2]:RC[196])" Range("C170").Value = "=SUM(RC[2]:RC[196])" Range("C172").Value = "=SUM(RC[2]:RC[196])" Range("C175").Value = "=SUM(RC[2]:RC[196])" Range("C176").Value = "=SUM(RC[2]:RC[196])" Range("C182").Value = "=SUM(RC[2]:RC[196])" Range("C185").Value = "=SUM(RC[2]:RC[196])" Range("C187").Value = "=SUM(RC[2]:RC[196])" Range("C189").Value = "=SUM(RC[2]:RC[196])" Range("C190").Value = "=SUM(RC[2]:RC[196])" Range("C191").Value = "=SUM(RC[2]:RC[196])" Range("C192").Value = "=SUM(RC[2]:RC[196])" Range("C193").Value = "=SUM(RC[2]:RC[196])" Range("C194").Value = "=SUM(RC[2]:RC[196])" Range("C195").Value = "=SUM(RC[2]:RC[196])" Range("C196").Value = "=SUM(RC[2]:RC[196])" Range("C199").Value = "=SUM(RC[2]:RC[196])" Range("C200").Value = "=SUM(RC[2]:RC[196])" Range("C201").Value = "=SUM(RC[2]:RC[196])" Range("C203").Value = "=SUM(RC[2]:RC[196])" Range("C206").Value = "=SUM(RC[2]:RC[196])" Range("C227").Value = "=SUM(RC[2]:RC[196])" Range("C229").Value = "=SUM(RC[2]:RC[196])" Range("C231").Value = "=SUM(RC[2]:RC[196])" Range("C233").Value = "=SUM(RC[2]:RC[196])" Range("C235").Value = "=SUM(RC[2]:RC[196])" Range("C236").Value = "=SUM(RC[2]:RC[196])" Range("C237").Value = "=SUM(RC[2]:RC[196])" Range("C238").Value = "=SUM(RC[2]:RC[196])" Range("C239").Value = "=SUM(RC[2]:RC[196])" Range("C241").Value = "=SUM(RC[2]:RC[196])" Range("C249").Value = "=SUM(RC[2]:RC[196])" Range("C252").Value = "=SUM(RC[2]:RC[196])" Range("C255").Value = "=SUM(RC[2]:RC[196])" Range("C256").Value = "=SUM(RC[2]:RC[196])" Range("C257").Value = "=SUM(RC[2]:RC[196])" Range("C258").Value = "=SUM(RC[2]:RC[196])" Range("C264").Value = "=SUM(RC[2]:RC[196])" Sheets("Beräkning").Range("c1:c50").Value = Sheets("Uträkningsdata").Range("d1:d50").Value Sheets("Uträkningsdata").Range("C1:C50").Delete Shift:=xlToLeft Sheets("Beräkning").Select Application.ScreenUpdating = True End Sub
  5. Sub område13() ' ' ' område13 Makro ' ' Sheets("13").Select Columns("E:E").Insert Shift:=xlToRight Range("E1").Value = Sheets("Formler").Range("B2").Value Range("E89").Value = Sheets("Formler").Range("H10").Value Range("E90").Value = Sheets("Formler").Range("H11").Value Range("E94").Value = Sheets("Formler").Range("K11").Value Range("E98").Value = Sheets("Formler").Range("M11").Value Range("E106").Value = Sheets("Formler").Range("H60").Value Range("E110").Value = Sheets("Formler").Range("H24").Value Range("E111").Value = Sheets("Formler").Range("H25").Value Range("E112").Value = Sheets("Formler").Range("H20").Value Range("E115").Value = Sheets("Formler").Range("K24").Value Range("E116").Value = Sheets("Formler").Range("K25").Value Range("E117").Value = Sheets("Formler").Range("K26").Value Range("E120").Value = Sheets("Formler").Range("O11").Value Range("E127").Value = Sheets("Formler").Range("H8").Value Range("E129").Value = Sheets("Formler").Range("K12").Value Range("E131").Value = Sheets("Formler").Range("M8").Value Range("E134").Value = Sheets("Formler").Range("O8").Value Range("E136").Value = Sheets("Formler").Range("H9").Value Range("E138").Value = Sheets("Formler").Range("H13").Value Range("E141").Value = Sheets("Formler").Range("K13").Value Range("E145").Value = Sheets("Formler").Range("M13").Value Range("E148").Value = Sheets("Formler").Range("O13").Value Range("E151").Value = Sheets("Formler").Range("H14").Value Range("E152").Value = Sheets("Formler").Range("H15").Value Range("E155").Value = Sheets("Formler").Range("K14").Value Range("E163").Value = Sheets("Formler").Range("R27").Value Range("E167").Value = Sheets("Formler").Range("H16").Value Range("E170").Value = Sheets("Formler").Range("H17").Value Range("E172").Value = Sheets("Formler").Range("H28").Value Range("E175").Value = Sheets("Formler").Range("R30").Value Range("E176").Value = Sheets("Formler").Range("R31").Value Range("E182").Value = Sheets("Formler").Range("H61").Value Range("E185").Value = Sheets("Formler").Range("R34").Value Range("E187").Value = Sheets("Formler").Range("R36").Value Range("E189").Value = Sheets("Formler").Range("H33").Value Range("E190").Value = Sheets("Formler").Range("H34").Value Range("E191").Value = Sheets("Formler").Range("H35").Value Range("E192").Value = Sheets("Formler").Range("H36").Value Range("E193").Value = Sheets("Formler").Range("H37").Value Range("E194").Value = Sheets("Formler").Range("H38").Value Range("E195").Value = Sheets("Formler").Range("H39").Value Range("E196").Value = Sheets("Formler").Range("H40").Value Range("E199").Value = Sheets("Formler").Range("H41").Value Range("E200").Value = Sheets("Formler").Range("H42").Value Range("E201").Value = Sheets("Formler").Range("H43").Value Range("E203").Value = Sheets("Formler").Range("K28").Value Range("E206").Value = Sheets("Formler").Range("M19").Value Range("E227").Value = Sheets("Formler").Range("H45").Value Range("E229").Value = Sheets("Formler").Range("H46").Value Range("E231").Value = Sheets("Formler").Range("H47").Value Range("E233").Value = Sheets("Formler").Range("H45").Value Range("E235").Value = Sheets("Formler").Range("H51").Value Range("E236").Value = Sheets("Formler").Range("H52").Value Range("E237").Value = Sheets("Formler").Range("H53").Value Range("E238").Value = Sheets("Formler").Range("H54").Value Range("E239").Value = Sheets("Formler").Range("H55").Value Range("E241").Value = Sheets("Formler").Range("H57").Value Range("E249").Value = Sheets("Formler").Range("O17").Value Range("E252").Value = Sheets("Formler").Range("O18").Value Range("E255").Value = Sheets("Formler").Range("O19").Value Range("E256").Value = Sheets("Formler").Range("O20").Value Range("E257").Value = Sheets("Formler").Range("O21").Value Range("E258").Value = Sheets("Formler").Range("O22").Value Range("E264").Value = Sheets("Formler").Range("O17").Value Columns("F:F").Value = Columns("E:E").Value Columns("C:C").Copy Columns("E:E").PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _ SkipBlanks:=False, Transpose:=False Application.CutCopyMode = False Columns("E:E").ClearContents Columns("c:c").Value = Sheets("Uträkningsdata").Columns("d:d").Value Sheets("Uträkningsdata").Range("C:C").Delete Shift:=xlToLeft End Sub Så här ser mitt makro ut nu, men nu går de as trögt och excell hänger sig varje gång jag kör det....
  6. Tack jag fixar de och skicar om, Hade rensat lika mycket som du men tyvärr råkar skicka fel modul Tack för hjälpen! Oavsett rensning finns de något sätt jag kan få koden att upprepas tills datan i uträkningsbladet är slut?
  7. Sub område13() ' ' område13 Makro ' ' Range("C1").Select Sheets("13").Select Columns("E:E").Select Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove Range("E1").Select ActiveCell.FormulaR1C1 = "=Formler!R[1]C[-3]" Range("E89").Select ActiveCell.FormulaR1C1 = "=Formler!R[-79]C[3]" Range("E90").Select ActiveCell.FormulaR1C1 = "=Formler!R[-79]C[3]" Range("E94").Select ActiveCell.FormulaR1C1 = "=Formler!R[-83]C[6]" Range("E98").Select ActiveCell.FormulaR1C1 = "=Formler!R[-87]C[8]" Range("E106").Select ActiveCell.FormulaR1C1 = "=Formler!R[-46]C[3]" Range("E110").Select ActiveCell.FormulaR1C1 = "=Formler!R[-86]C[3]" Range("E111").Select ActiveCell.FormulaR1C1 = "=Formler!R[-86]C[3]" Range("E112").Select ActiveCell.FormulaR1C1 = "=Formler!R[-92]C[3]" Range("E115").Select ActiveCell.FormulaR1C1 = "=Formler!R[-91]C[6]" Range("E116").Select ActiveCell.FormulaR1C1 = "=Formler!R[-91]C[6]" Range("E117").Select ActiveCell.FormulaR1C1 = "=Formler!R[-91]C[6]" Range("E120").Select ActiveCell.FormulaR1C1 = "=Formler!R[-109]C[10]" Range("E127").Select ActiveCell.FormulaR1C1 = "=Formler!R[-119]C[3]" Range("E129").Select ActiveCell.FormulaR1C1 = "=Formler!R[-117]C[6]" Range("E131").Select ActiveCell.FormulaR1C1 = "=Formler!R[-123]C[8]" Range("E134").Select ActiveCell.FormulaR1C1 = "=Formler!R[-126]C[10]" Range("E136").Select ActiveCell.FormulaR1C1 = "=Formler!R[-127]C[3]" Range("E138").Select ActiveCell.FormulaR1C1 = "=Formler!R[-125]C[3]" Range("E141").Select ActiveCell.FormulaR1C1 = "=Formler!R[-128]C[6]" Range("E145").Select ActiveCell.FormulaR1C1 = "=Formler!R[-132]C[8]" Range("E148").Select ActiveCell.FormulaR1C1 = "=Formler!R[-135]C[10]" Range("E151").Select ActiveCell.FormulaR1C1 = "=Formler!R[-137]C[3]" Range("E152").Select ActiveCell.FormulaR1C1 = "=Formler!R[-137]C[3]" Range("E155").Select ActiveCell.FormulaR1C1 = "=Formler!R[-141]C[6]" Range("E163").Select ActiveCell.FormulaR1C1 = "=Formler!R[-136]C[13]" Range("E167").Select ActiveCell.FormulaR1C1 = "=Formler!R[-151]C[3]" Range("E170").Select ActiveCell.FormulaR1C1 = "=Formler!R[-153]C[3]" Range("E172").Select ActiveCell.FormulaR1C1 = "=Formler!R[-144]C[3]" Range("E175").Select ActiveCell.FormulaR1C1 = "=Formler!R[-145]C[13]" Range("E176").Select ActiveCell.FormulaR1C1 = "=Formler!R[-145]C[13]" Range("E182").Select ActiveCell.FormulaR1C1 = _ "=(Formler!R[-136]C[3]+Formler!R[-135]C[3]+Formler!R[-134]C[3]+Formler!R[-133]C[3])*2" Range("E185").Select ActiveCell.FormulaR1C1 = "=Formler!R[-151]C[13]" Range("E187").Select ActiveCell.FormulaR1C1 = "=Formler!R[-151]C[13]" Range("E189").Select ActiveCell.FormulaR1C1 = "=Formler!R[-156]C[3]" Range("E190").Select ActiveCell.FormulaR1C1 = "=Formler!R[-156]C[3]" Range("E191").Select ActiveCell.FormulaR1C1 = "=Formler!R[-156]C[3]" Range("E192").Select ActiveCell.FormulaR1C1 = "=Formler!R[-156]C[3]" Range("E193").Select ActiveCell.FormulaR1C1 = "=Formler!R[-156]C[3]" Range("E194").Select ActiveCell.FormulaR1C1 = "=Formler!R[-156]C[3]" Range("E195").Select ActiveCell.FormulaR1C1 = "=Formler!R[-156]C[3]" Range("E196").Select ActiveCell.FormulaR1C1 = "=Formler!R[-156]C[3]" Range("E199").Select ActiveCell.FormulaR1C1 = "=Formler!R[-158]C[3]" Range("E200").Select ActiveCell.FormulaR1C1 = "=Formler!R[-158]C[3]" Range("E201").Select ActiveCell.FormulaR1C1 = "=Formler!R[-158]C[3]" Range("E203").Select ActiveCell.FormulaR1C1 = "=Formler!R[-175]C[6]" Range("E206").Select ActiveCell.FormulaR1C1 = "=Formler!R[-187]C[8]" Range("E227").Select ActiveCell.FormulaR1C1 = "=Formler!R[-182]C[3]" Range("E229").Select ActiveCell.FormulaR1C1 = "=Formler!R[-183]C[3]" Range("E231").Select ActiveCell.FormulaR1C1 = "=Formler!R[-184]C[3]" Range("E233").Select ActiveCell.FormulaR1C1 = "=Formler!R[-188]C[3]" Range("E235").Select ActiveCell.FormulaR1C1 = "=Formler!R[-184]C[3]" Range("E236").Select ActiveCell.FormulaR1C1 = "=Formler!R[-184]C[3]" Range("E237").Select ActiveCell.FormulaR1C1 = "=Formler!R[-184]C[3]" Range("E238").Select ActiveCell.FormulaR1C1 = "=Formler!R[-184]C[3]" Range("E239").Select ActiveCell.FormulaR1C1 = "=Formler!R[-184]C[3]" Range("E241").Select ActiveCell.FormulaR1C1 = "=Formler!R[-184]C[3]" Range("E249").Select ActiveCell.FormulaR1C1 = "=Formler!R[-232]C[10]" Range("E252").Select ActiveCell.FormulaR1C1 = "=Formler!R[-234]C[10]" Range("E255").Select ActiveCell.FormulaR1C1 = "=Formler!R[-236]C[10]" Range("E256").Select ActiveCell.FormulaR1C1 = "=Formler!R[-236]C[10]" Range("E257").Select ActiveCell.FormulaR1C1 = "=Formler!R[-236]C[10]" Range("E258").Select ActiveCell.FormulaR1C1 = "=Formler!R[-236]C[10]" Range("E264").Select ActiveCell.FormulaR1C1 = "=Formler!R[-247]C[10]" Range("E281").Select Columns("C:C").Copy Columns("E:E").PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _ SkipBlanks:=False, Transpose:=False Application.CutCopyMode = False Columns("E:E").Copy Columns("F:F").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Columns("E:E").ClearContents Range("C89").FormulaR1C1 = "=SUM(RC[3]:RC[800])" Range("C89").AutoFill Destination:=Range("C89:C180"), Type:=xlFillDefault Range("C189").FormulaR1C1 = "=SUM(RC[3]:RC[800])" Range("C189").AutoFill Destination:=Range("C189:C264"), Type:=xlFillDefault Sheets("Uträkningsdata").Range("C:C").Copy Sheets("Beräkning").Range("C1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Uträkningsdata").Range("C:C").Delete Shift:=xlToLeft Sheets("Beräkning").Select End Sub Här kommer min rensade kod
  8. Hej! Jag har skrivit ett makro som tar data från ett "uträkningsdata blad" flyttar och tar bort värdena i en kolumn där och lägger dem i ett "beräknings blad" och skulle vilja att de upprepades tills kolumnen i bladet "uträkningsdata" är tom på data. då vill jag att upprepningen avslutas. sen undrar jag även om de går att städa något i makrot. jag är självlärd på detta och vill gärna lära mig mer! Sub område13() ' ' område13 Makro ' ' Range("C1").Select Sheets("13").Select Columns("E:E").Select Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove Range("E1").Select ActiveCell.FormulaR1C1 = "=Formler!R[1]C[-3]" Range("E89").Select ActiveCell.FormulaR1C1 = "=Formler!R[-87]C[13]" Range("E90").Select ActiveCell.FormulaR1C1 = "=Formler!R[-87]C[13]" Range("E94").Select ActiveCell.FormulaR1C1 = "=Formler!R[-83]C[6]" Range("E96").Select ActiveCell.FormulaR1C1 = "=Formler!R[-85]C[8]" Range("E98").Select ActiveCell.FormulaR1C1 = "=Formler!R[-87]C[10]" Range("E101").Select ActiveCell.FormulaR1C1 = "=Formler!R[-78]C[3]" Range("E110").Select ActiveCell.FormulaR1C1 = "=Formler!R[-86]C[3]" Range("E111").Select ActiveCell.FormulaR1C1 = "=Formler!R[-86]C[3]" Range("E112").Select ActiveCell.FormulaR1C1 = "=Formler!R[-92]C[3]" Range("E115").Select ActiveCell.FormulaR1C1 = "=Formler!R[-91]C[6]" Range("E116").Select ActiveCell.FormulaR1C1 = "=Formler!R[-91]C[6]" Range("E117").Select ActiveCell.FormulaR1C1 = "=Formler!R[-91]C[6]" Range("E120").Select ActiveCell.FormulaR1C1 = "=Formler!R[-110]C[10]" Range("E127").Select ActiveCell.FormulaR1C1 = "=Formler!R[-119]C[3]" Range("E129").Select ActiveCell.FormulaR1C1 = "=Formler!R[-117]C[6]" Range("E131").Select ActiveCell.FormulaR1C1 = "=Formler!R[-123]C[8]" Range("E134").Select ActiveCell.FormulaR1C1 = "=Formler!R[-126]C[10]" Range("E138").Select ActiveCell.FormulaR1C1 = "=Formler!R[-125]C[3]" Range("E141").Select ActiveCell.FormulaR1C1 = "=Formler!R[-128]C[6]" Range("E145").Select ActiveCell.FormulaR1C1 = "=Formler!R[-132]C[8]" Range("E148").Select ActiveCell.FormulaR1C1 = "=Formler!R[-135]C[10]" Range("E151").Select ActiveCell.FormulaR1C1 = "=Formler!R[-137]C[3]" Range("E152").Select ActiveCell.FormulaR1C1 = "=Formler!R[-137]C[3]" Range("E155").Select ActiveCell.FormulaR1C1 = "=Formler!R[-141]C[6]" Range("E163").Select ActiveCell.FormulaR1C1 = "=Formler!R[-136]C[3]" Range("E167").Select ActiveCell.FormulaR1C1 = "=Formler!R[-151]C[3]" Range("E170").Select ActiveCell.FormulaR1C1 = "=Formler!R[-153]C[3]" Range("E172").Select ActiveCell.FormulaR1C1 = "=Formler!R[-144]C[3]" Range("E175").Select ActiveCell.FormulaR1C1 = "=Formler!R[-144]C[3]" Range("E176").Select ActiveCell.FormulaR1C1 = "=Formler!R[-144]C[3]" Range("E189").Select ActiveCell.FormulaR1C1 = "=Formler!R[-156]C[3]" Range("E190").Select ActiveCell.FormulaR1C1 = "=Formler!R[-156]C[3]" Range("E191").Select ActiveCell.FormulaR1C1 = "=Formler!R[-156]C[3]" Range("E192").Select ActiveCell.FormulaR1C1 = "=Formler!R[-156]C[3]" Range("E193").Select ActiveCell.FormulaR1C1 = "=Formler!R[-156]C[3]" Range("E194").Select ActiveCell.FormulaR1C1 = "=Formler!R[-156]C[3]" Range("E195").Select ActiveCell.FormulaR1C1 = "=Formler!R[-156]C[3]" Range("E196").Select ActiveCell.FormulaR1C1 = "=Formler!R[-156]C[3]" Range("E199").Select ActiveCell.FormulaR1C1 = "=Formler!R[-158]C[3]" Range("E200").Select ActiveCell.FormulaR1C1 = "=Formler!R[-158]C[3]" Range("E201").Select ActiveCell.FormulaR1C1 = "=Formler!R[-158]C[3]" Range("E203").Select ActiveCell.FormulaR1C1 = "=Formler!R[-175]C[6]" Range("E206").Select ActiveCell.FormulaR1C1 = "=Formler!R[-187]C[8]" Range("E227").Select ActiveCell.FormulaR1C1 = "=Formler!R[-182]C[3]" Range("E229").Select ActiveCell.FormulaR1C1 = "=Formler!R[-183]C[3]" Range("E235").Select ActiveCell.FormulaR1C1 = "=Formler!R[-186]C[3]" Range("E236").Select ActiveCell.FormulaR1C1 = "=Formler!R[-186]C[3]" Range("E237").Select ActiveCell.FormulaR1C1 = "=Formler!R[-186]C[3]" Range("E238").Select ActiveCell.FormulaR1C1 = "=Formler!R[-186]C[3]" Range("E239").Select ActiveCell.FormulaR1C1 = "=Formler!R[-186]C[3]" Range("E241").Select ActiveCell.FormulaR1C1 = "=Formler!R[-188]C[3]" Range("E249").Select ActiveCell.FormulaR1C1 = "=Formler!R[-232]C[10]" Range("E252").Select ActiveCell.FormulaR1C1 = "=Formler!R[-234]C[10]" Range("E255").Select ActiveCell.FormulaR1C1 = "=Formler!R[-236]C[10]" Range("E256").Select ActiveCell.FormulaR1C1 = "=Formler!R[-236]C[10]" Range("E257").Select ActiveCell.FormulaR1C1 = "=Formler!R[-236]C[10]" Range("E258").Select ActiveCell.FormulaR1C1 = "=Formler!R[-236]C[10]" Range("E264").Select ActiveCell.FormulaR1C1 = "=Formler!R[-247]C[10]" Columns("e:e").Select Selection.Copy Columns("f:f").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Columns("e:e").Select Application.CutCopyMode = False Selection.ClearContents Columns("C:C").Select Selection.Copy Columns("E:E").Select Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _ SkipBlanks:=False, Transpose:=False Application.CutCopyMode = False Range("C88").Select ActiveCell.FormulaR1C1 = "=SUM(RC[3]:RC[620])" Range("C88").Select Selection.AutoFill Destination:=Range("C88:C177"), Type:=xlFillDefault Range("C88:C177").Select Range("C187").Select ActiveCell.FormulaR1C1 = "=SUM(RC[3]:RC[620])" Range("C187").Select Selection.AutoFill Destination:=Range("C187:C299"), Type:=xlFillDefault Range("C187:C299").Select Range("C1").Select Sheets("Beräkning").Select Range("C1").Select Sheets("Uträkningsdata").Select Range("D1:D49").Select Selection.Copy Sheets("Beräkning").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Uträkningsdata").Select Columns("C:C").Select Application.CutCopyMode = False Selection.Delete Shift:=xlToLeft Sheets("Beräkning").Select Range("C1").Select End Sub
  9. Tack så mycket för hjälpen! efter att ha trixat lite så fungerar det nu precis som jag vill!
  10. Jag är väldigt ny på de här med macron men såhär ser det ut, bifogar en word fil med koden för jag lyckas inte klistra i den här. det kanske fungerar som du skrivit ovanför men jag är inte säker på att jag hänger med hela vägen. Sub Makro5.docx
  11. Hej! Nu skulle jag behöva lite hjälp igen. jag vill skapa ett macro kopplat till en knapp som: öppnar en ny flik, skapar nya rader i befintlig flik, skriver in formel i dessa rader kopplade till ny flik. detta har jag också lykats göra, MEN när jag använder min knapp gång nr2, då får jag exat samma formel som jag fick första gången och därför kopplar formeln till den första fliken som skapades. Att de blir så här kanske inte är så konstigt men hur gör jag för att macrot ska skapa en formel som kopplar till den nya fliken? Tacksam för hjälp! // Lisa
  12. Hej! Jag försöker skapa en formel men de går inte så bra då jag bara gått grundkurs i Excel och de var några år sedan. Tanken är att min formel ska hitta det jag skriver i ruta F10 från blad1 i kolumn C:Q på samma rad som den hittar de jag skriver står i kolumn J ett tal som jag vill att formeln hämtar. min första formel såg ut så här =LETAUPP(F10;´blad!´0:Q;´blad1´!J:J Men den gör inte riktigt de jag vill. T.ex Om jag skriver a.31 i ruta F10 och de inte finns någon a.31 i kolumn C:Q utan bara a.31.1 så får jag något helt galet tal som jag inte vet vart den hämtar. Det jag skulle vilja är att formeln blev lika med 0 om jag söker något som inte finns i Kolumn C;Q. Jag testa att skriva =OMFEL(LETAUPP(f10;´blad1´!C:Q;´bald1´!J:J);0) Vilket resulterade i9 exakt samma tal som första formeln. Om jag istället skriver =OMFEL(LETARAD(F10;´blad1´!C:Q;´blad1´!J:J;FALSKT);0) Får jag värdet 0 men även om jag ändrar innehållet i F10 till a31.1 så fortsätter värdet att vara 0. Snälla hjälp mig hitta en fungerade formel!
×
×
  • Skapa nytt...