Basisdokumentation for biogaspotentialet i organisk dagrenovation

Appendiks C: VBA makrokode

Microsoft Visual Basic kode for makro "Visresult"

Sub Visresult()

Application.ScreenUpdating = False       'slukker skærm

SLETRESULT        'sletter tidligere resultater

Sheets("Inddata, niveau1").Select
If Cells(6, 5) > 0 Then

Cells(22, 3).Select
ActiveCell.Value = "1"       'vælger affaldstype Hovedstadsområdet

Cells(23, 3).Select      'vælger forbehandling rullesigte
ActiveCell.Value = "1"

Sheets("Energistrømme").Range("c27 : i27").Copy
Sheets("Resultat Oversigt").Select
Cells(5, 4).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
False, Transpose:=False       'kopierer energiresultater
Sheets("co2-strømme").Range("c26:i26").Copy
Sheets("Resultat Oversigt").Select
Cells(5, 12).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
False, Transpose:=False       'kopierer CO2 resultater

Sheets("inddata, niveau1").Select
Cells(23, 3).Select
ActiveCell.Value = "2"       'vælger forbehandling skruepresse

Sheets("Energistrømme").Range("c27 : i27").Copy
Sheets("Resultat Oversigt").Select
Cells(6, 4).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
False, Transpose:=False       'kopierer energiresultater
Sheets("co2-strømme").Range("c26:i26").Copy
Sheets("Resultat Oversigt").Select
Cells(6, 12).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
False, Transpose:=False      'kopierer CO2 resultater

Sheets("Inddata, niveau1").Select
Cells(22, 3).Select
ActiveCell.Value = "2"             'vælger affaldstype Kolding

Cells(23, 3).Select

ActiveCell.Value = "1"         'vælger forbehandling rullesigte

Sheets("Energistrømme").Range("c27 : i27").Copy
Sheets("Resultat Oversigt").Select
Cells(8, 4).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False      'kopierer energiresultater
Sheets("co2-strømme").Range("c26:i26").Copy
Sheets("Resultat Oversigt").Select
Cells(8, 12).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False      'kopierer CO2 resultater

Sheets("inddata, niveau1").Select
Cells(23, 3).Select
ActiveCell.Value = "2"       'vælger forbehandling skruepresse

Sheets("Energistrømme").Range("c27 : i27").Copy
Sheets("Resultat Oversigt").Select
Cells(9, 4).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False        'kopierer energiresultater
Sheets("co2-strømme").Range("c26:i26").Copy
Sheets("Resultat Oversigt").Select
Cells(9, 12).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False       'kopierer CO2 resultater

Sheets("Inddata, niveau1").Select
Cells(22, 3).Select       'vælger affaldstype Vejle

ActiveCell.Value = "3"

Cells(23, 3).Select          'vælger forbehandling rullesigte
ActiveCell.Value = "1"

Sheets("Energistrømme").Range("c27 : i27").Copy
Sheets("Resultat Oversigt").Select
Cells(11, 4).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False       'kopierer energiresultater
Sheets("co2-strømme").Range("c26:i26").Copy
Sheets("Resultat Oversigt").Select
Cells(11, 12).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False       'kopierer CO2 resultater

Sheets("inddata, niveau1").Select
Cells(23, 3).Select
ActiveCell.Value = "2"          'vælger forbehandling skruepresse

Sheets("Energistrømme").Range("c27 : i27").Copy
Sheets("Resultat Oversigt").Select
Cells(12, 4).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("co2-strømme").Range("c26:i26").Copy
Sheets("Resultat Oversigt").Select
Cells(12, 12).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False           'kopierer CO2 resultater

Sheets("Inddata, niveau1").Select
Cells(22, 3).Select          'vælger affaldstype Ålborg
ActiveCell.Value = "4"

Cells(23, 3).Select
ActiveCell.Value = "1"         'vælger forbehandling rullesigte

Sheets("Energistrømme").Range("c27 : i27").Copy
Sheets("Resultat Oversigt").Select
Cells(14, 4).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False 'kopierer energi resultater
Sheets("co2-strømme").Range("c26:i26").Copy
Sheets("Resultat Oversigt").Select
Cells(14, 12).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False         'kopierer CO2 resultater

Sheets("inddata, niveau1").Select
Cells(23, 3).Select
ActiveCell.Value = "2"            'vælger forbehandling skruepresse

Sheets("Energistrømme").Range("c27 : i27").Copy
Sheets("Resultat Oversigt").Select
Cells(15, 4).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False            'kopierer energi resultater
Sheets("co2-strømme").Range("c26:i26").Copy
Sheets("Resultat Oversigt").Select
Cells(15, 12).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False         'kopierer CO2 resultater

Sheets("Inddata, niveau1").Select
Cells(22, 3).Select
ActiveCell.Value = "5"         'vælger affaldstype Grindsted

Cells(23, 3).Select
ActiveCell.Value = "5"         .vælger forbehandling ingen

Sheets("Energistrømme").Range("c27 : i27").Copy
Sheets("Resultat Oversigt").Select
Cells(17, 4).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False         'kopiere energi resultater
Sheets("co2-strømme").Range("c26:i26").Copy
Sheets("Resultat Oversigt").Select
Cells(17, 12).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False         'kopierer CO2 resultater

End If

'Forbrændingsscenarier med 4 typer affald

Sheets("inddata, niveau1").Select
Cells(6, 5).Select
ActiveCell.Copy           'kopierer mængde affald til forbrænding

Cells(7, 5).Select
Selection.PasteSpecial Paste:=xlValue, Operation:=xlAdd, SkipBlanks:=False _ , Transpose:=False
Cells(6, 5).Value = "0"

Cells(22, 3).Select
ActiveCell.Value = "1"             'vælger affaldstype Hovedstadsområdet

Sheets("Energistrømme").Range("c27 : i27").Copy
Sheets("Resultat Oversigt").Select
Cells(7, 4).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("co2-strømme").Range("c26:i26").Copy
Sheets("Resultat Oversigt").Select
Cells(7, 12).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False

Sheets("inddata, niveau1").Select
Cells(22, 3).Select
ActiveCell.Value = "2"            'vælger affaldstype Kolding

Sheets("Energistrømme").Range("c27 : i27").Copy
Sheets("Resultat Oversigt").Select
Cells(10, 4).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("co2-strømme").Range("c26:i26").Copy
Sheets("Resultat Oversigt").Select
Cells(10, 12).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False

Sheets("inddata, niveau1").Select
Cells(22, 3).Select
ActiveCell.Value = "3"         'vælger affaldstype Vejle

Sheets("Energistrømme").Range("c27 : i27").Copy
Sheets("Resultat Oversigt").Select
Cells(13, 4).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("co2-strømme").Range("c26:i26").Copy
Sheets("Resultat Oversigt").Select
Cells(13, 12).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False

Sheets("inddata, niveau1").Select
Cells(22, 3).Select
ActiveCell.Value = "4"         'vælger affaldstype Ålborg

Sheets("Energistrømme").Range("c27 : i27").Copy Sheets("Resultat Oversigt").Select
Cells(16, 4).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("co2-strømme").Range("c26:i26").Copy
Sheets("Resultat Oversigt").Select
Cells(16, 12).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False

Sheets("inddata, niveau1").Select
Cells(22, 3).Select
ActiveCell.Value = "5"             'vælger affaldstype Grindsted

Sheets("Energistrømme").Range("c27 : i27").Copy
Sheets("Resultat Oversigt").Select
Cells(18, 4).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("co2-strømme").Range("c26:i26").Copy
Sheets("Resultat Oversigt").Select
Cells(18, 12).Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False

Sheets("inddata, niveau1").Select
Cells(7, 5).Copy
Cells(6, 5).Select
ActiveSheet.Paste
Cells(7, 5).Value = "0"

'Kopier ind antagelser for resultaterne

Sheets("massestrømme").Select
Range("f5: g12").Copy
Sheets("Resultat Oversigt").Select
Range("b22: c29").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False,
Transpose:=False

Application.CutCopyMode = False
Sheets("massestrømme").Select
Range("h5: h12").Copy
Sheets("Resultat Oversigt").Select
Range("e22: e29 ").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False,
Transpose:=False
Application.CutCopyMode = False

Application.ScreenUpdating = True           'tænder skærm
End Sub