Option
Explicit
Public
Sub
Forward()
Const
LONG_MAX
As
Long
= 2147483647
Dim
first1
As
String
Dim
first2
As
Long
Dim
all1(1
To
2)
As
String
Dim
all2(1
To
2)
As
String
first1 =
"F"
With
ActiveSheet
If
.Range(
"AI7395"
).Value > LONG_MAX
Then
MsgBox
"Programmabbruch:"
& vbCr & _
"Der Wertebereich für den Long-Datentyp wird überschritten."
, _
vbExclamation,
"Exit"
:
Exit
Sub
ElseIf
.Range(
"AI7395"
).Value = vbNullString
Then
MsgBox
"Programmabbruch:"
& vbCr & _
"Zelle enthält keine Zahl."
, vbExclamation,
"Exit"
:
Exit
Sub
End
If
first2 = .Range(
"AI7395"
).Value
first2 =
CLng
(first2)
first2 = first2 + 4
first2 =
CStr
(first2)
all1(1) = first1 & first2
first2 =
CLng
(first2)
first2 = first2 + 6
first2 =
CStr
(first2)
all2(1) = first1 & first2
first2 = .Range(
"AI7395"
).Value
first2 =
CLng
(first2)
first2 = first2 + 5
first2 =
CStr
(first2)
all1(2) = first1 & first2
first2 =
CLng
(first2)
first2 = first2 + 6
first2 =
CStr
(first2)
all2(2) = first1 & first2
If
first2 <= .Rows.Count
Then
_
.Range(all1(1) &
":"
& all2(1)).Cut Destination:=Range(all1(2) &
":"
& all2(2))
.Shapes(
"Button 36"
).IncrementTop 12.6
.Shapes(
"Button 37"
).IncrementTop 12.6
.Shapes(
"Button 38"
).IncrementTop 12.6
all1(2) = .Range(
"AI7395"
).Value
all1(2) =
CLng
(all1(2))
all1(2) = all1(2) & 1
all1(2) =
CStr
(all1(2))
.Range(
"AI7395"
).Value = all1(2)
End
With
End
Sub
Deine ganzen Casts müsstest Du noch selbst zusammenkürzen...
Gruß,