---
title: "If Then else.."
type: "forum-thread"
url: "https://www.webforum.nu/amne/dotnet/109588-if-then-else"
topic: ".NET"
topic_url: "https://www.webforum.nu/amne/dotnet"
author: "Kalle M"
published: "2004-08-19T11:00:53.000Z"
updated: "2004-08-19T19:13:42.000Z"
replies: 3
views: 463
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/dotnet/109588-if-then-else"
---

# If Then else..

## #1 — Kalle M, 2004-08-19T11:00Z

Fått för mig att alla If Then else satser avslutas med End if !?

Varför inte i denna? För att jag inte blandat in Else?
Funkar ju i och för sig :-)  

```
Sub JanuariKalkyl()
    If ActiveCell.Offset(0, 1).FormulaR1C1 _
        = "" Then _
            ActiveCell.Offset(0, 1). _
                FormulaR1C1 = "Januari"
    If ActiveCell.Offset(1, 0).FormulaR1C1 _
        = "" Then _
            ActiveCell.Offset(1, 0). _
                FormulaR1C1 = "Kassa"
    If ActiveCell.Offset(1, 1).FormulaR1C1 _
        = "" Then _
            ActiveCell.Offset(1, 1). _
                FormulaR1C1 = "40000"
    If ActiveCell.Offset(2, 0).FormulaR1C1 _
        = "" Then _
            ActiveCell.Offset(2, 0). _
                FormulaR1C1 = "Hyra"
    If ActiveCell.Offset(2, 1).FormulaR1C1 _
        = "" Then _
            ActiveCell.Offset(2, 1). _
                FormulaR1C1 = "8000"
    If ActiveCell.Offset(3, 0).FormulaR1C1 _
        = "" Then _
            ActiveCell.Offset(3, 0). _
                FormulaR1C1 = "Material"
    If ActiveCell.Offset(3, 1).FormulaR1C1 _
        = "" Then _
            ActiveCell.Offset(3, 1). _
                FormulaR1C1 = "5000"
    If ActiveCell.Offset(4, 0).FormulaR1C1 _
        = "" Then _
            ActiveCell.Offset(4, 0). _
                FormulaR1C1 = "Lön"
    If ActiveCell.Offset(4, 1).FormulaR1C1 _
        = "" Then _
            ActiveCell.Offset(4, 1). _
                FormulaR1C1 = "20000"
    If ActiveCell.Offset(5, 0).FormulaR1C1 _
        = "" Then _
            ActiveCell.Offset(5, 0). _
                FormulaR1C1 = "Resultat"
    If ActiveCell.Offset(5, 1).FormulaR1C1 _
        = "" Then _
            ActiveCell.Offset(5, 1). _
                FormulaR1C1 = _
                "=R[-4]C-R[-3]C-R[-2]C-R[-1]C"
End Sub
```

Permalänk: https://www.webforum.nu/p/109588

## #2 — Erik Juhlin, 2004-08-19T11:02Z

För att du kör if satserna på samma rad (med \_).

Permalänk: https://www.webforum.nu/p/1416432

## #3 — @nders, 2004-08-19T11:03Z

Här har du alla if-satser på en rad var (faktiskt, eftersom du valt att bryta dem med \_). Hade de varit uppdelade på annat sätt hade du varit tvungen att ha ett end if för varje if-sats, eller ett enda end if sist, om alla dina if skrivits om till elseif.

Hajen sie? :)

Permalänk: https://www.webforum.nu/p/1416435

## #4 — Kalle M, 2004-08-19T19:13Z

Ok tack! :-)

Permalänk: https://www.webforum.nu/p/1416713

---

Tråden på webben: https://www.webforum.nu/amne/dotnet/109588-if-then-else
