AW: Wort in Spalte suchen und Zeilennr, als variable
26.03.2018 15:23:16
Peter(silie)
Hallo,
wenn die Sachen ausschließlich im Code hinterlegt seien sollen,
dann ist ein Enum was du suchst.
Ansonsten würde ich zu Get/Let Methoden wechseln.
Hier beispiele:
Option Explicit
Private Enum CustomRows
Hase = 1
Hund = 4
Haus = 16
Harald = 20
Herz = 22
Husten = 50
End Enum
Sub a()
'.Cells((LoI, 19).Formula = "=J" & CustomRows.Haus & "/100"
Debug.Print CustomRows.Harald
Debug.Print CustomRows.Haus
Debug.Print CustomRows.Husten
Debug.Print CustomRows.Herz
End Sub
Beispiel 2:
Option Explicit
Private haus_ As Long
Private harald_ As Long
Private herz_ As Long
Private Property Get Haus() As Long
Haus = haus_
End Property
Private Property Let Haus(ByVal value_ As Long)
haus_ = value_
End Property
Private Property Get Harald() As Long
Harald = harald_
End Property
Private Property Let Harald(ByVal value_ As Long)
harald_ = value_
End Property
Private Property Get Herz() As Long
Herz = 22
End Property
Private Property Let Herz(ByVal value_ As Long)
herz_ = value_
End Property
Sub a()
'.Cells((LoI, 19).Formula = "=J" & Haus & "/100"
Haus = 16
Harald = 20
Herz = 22
Debug.Print Haus
Debug.Print Harald
Debug.Print Herz
End Sub