Option
Explicit
Sub
Umbenennen()
Dim
strKey
As
String
, strAWKey
As
String
, strStart
As
String
, strAWStart
As
String
, strKST
As
String
Dim
strAWKST
As
String
, strUml
As
String
, strAWUml
As
String
, i
As
Long
strKey =
"Bezeichnung des Kostenschlüssels"
strStart =
"In welcher Zeile beginnen die Daten?"
strKST =
"In welcher Spalte sind die Kostenstellen? (als Zahl)"
strUml =
"In welcher Spalte sind die Umlageschlüssel? (als Zahl)"
strAWKey = InputBox(strKey)
strAWStart = InputBox(strStart)
strAWKST = InputBox(strKST)
strAWUml = InputBox(strUml)
With
ActiveSheet
For
i = strAWStart
To
.Cells(.Rows.Count, strAWUml).
End
(xlUp).Row
.Cells(i, strAWUml).
Select
ActiveWorkbook.Names.Add Name:=strAWKey & .Cells(i, strAWKST), RefersTo:= _
"=Umlage!"
& .Cells(i, strAWUml).Address
Next
End
With
End
Sub