Public Const F0006 = "Funktion nur bei den BKW-Blättern zulässig"
Public Const F0007 = "Positionsart B oder P eintragen"
Public Const F0008 = "Einbaumenge muß Wert > 0 sein"
Public Const F0009 = "Preiskennzeichen C / F oder D zulässig"
Dim b_ze()
Dim ze, b
Sub Starten_cmdFormatieren()
Sheets("initial").Select
Range("L24:M24").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AD24:AE24").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("minor").Select
Range("L24:M24").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Range("AD24:AE24").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("allgemein").Select
ActiveWindow.SmallScroll Down:=-12
Range("A1").Select
Application.ScreenUpdating = False
Sheets("initial").Select
If Range("B1") = "Version 1.0 A" Then
Else
Mldg = "Sie greifen auf eine ältere BKW-Tabelle zu." & Chr(13) & " Bitte Update auf Version 1.0 A durchführen !!! "
Stil = vbExclamation
Title = "Meldung"
Ergebnis = MsgBox(Mldg, Stil, Title)
Exit Sub
End If
If Range("A1") = "exbkw" Or Range("A1") = "BKW" Then
Ergebnis = MsgBox(F0006, vbOKOnly, "Code No. 0006")
Exit Sub
End If
ze = 23: sp = 3
If IsEmpty(Cells(23, 3)) Then
MsgBox ("Leer !!!")
Exit Sub
End If
If ActiveSheet.FilterMode Then
ActiveSheet.ShowAllData
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
ActiveWindow.ScrollRow = 1
ActiveWindow.ScrollColumn = 3
Range("c1:e21").Select
ReDim b_ze(1 To 500): b = 0 'Markierung Stoll 230 in 500 geändert
Do While Not IsEmpty(Cells(ze, sp))
G = UCase(Cells(ze, 3))
Cells(ze, 3) = G
If Cells(ze, sp) = "P" Then
Cells(ze, 7) = "=roundup(r[0]c[80],0)"
G1 = UCase(Cells(ze, 11))
Cells(ze, 11) = G1
If G1 = "C" Or G1 = "F" Or G1 = "D" Or G1 = "" Then
Else
Ergebnis = MsgBox(F0009, vknurok, "Code No. 0009")
Cells(ze, 11).Activate
Exit Sub
End If
ElseIf Cells(ze, sp) = "B" Then
If Cells(ze, 6) = 0 Or Cells(ze, 6) = "" Then
Ergebnis = MsgBox(F0008, vknurok, "Code No. 0008")
Cells(ze, 6).Activate
Exit Sub
End If
b = b + 1
b_ze(b) = ze
Else
Ergebnis = MsgBox(F0007, vknurok, "Code No. 0007")
Cells(ze, 3).Activate
Exit Sub
End If
ze = ze + 1
Loop 'Until IsEmpty(Cells(ze, sp))
If b > 0 Then
ReDim Preserve b_ze(1 To b)
End If
ze = ze - 1
'*********************************************************************************
With Range(Cells(23, 3), Cells(ze, 87))
With .Interior
.ColorIndex = xlAutomatic
.Pattern = xlSolid
End With
With .Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlNone
.ColorIndex = xlAutomatic
End With
If ze > 23 Then
With .Borders(xlInsideHorizontal)
.Weight = xlHairline
.ColorIndex = 11
End With
End If
With .Borders(xlEdgeBottom)
.Weight = xlHairline
.ColorIndex = 11
End With
With .Borders(xlInsideVertical)
.Weight = xlHairline
.ColorIndex = 11
End With
End With
With Range(Cells(23, 2), Cells(ze, 2))
With .Interior
.ColorIndex = 20
.Pattern = xlSolid
End With
With .Borders(xlRight)
.Weight = xlMedium
.ColorIndex = 11
End With
End With
For s = 15 To 21 Step 3
With Range(Cells(23, s), Cells(ze, s)).Borders(xlRight)
.Weight = xlMedium
.ColorIndex = 11
End With
Next
With Range(Cells(23, 87), Cells(ze, 87))
With .Borders(xlLeft)
.Weight = xlMedium
.ColorIndex = 11
End With
With .Interior
.ColorIndex = 19
.Pattern = xlSolid
End With
With .Borders(xlRight)
.Weight = xlMedium
.ColorIndex = 11
End With
End With
For x = 1 To b
With Range(Cells(b_ze(x), 3), Cells(b_ze(x), 86))
With .Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlNone
.ColorIndex = 3
End With
With .Interior
.ColorIndex = 40
.Pattern = xlSolid
End With
End With
Next
Sheets("minor").Select
If Range("B1") = "Version 1.0 A" Then
Else
Mldg = "Sie greifen auf eine ältere BKW-Tabelle zu." & Chr(13) & " Bitte Update auf Version 1.0 A durchführen !!! "
Stil = vbExclamation
Title = "Meldung"
Ergebnis = MsgBox(Mldg, Stil, Title)
Exit Sub
End If
If Range("A1") = "exbkw" Or Range("A1") = "BKW" Then
Ergebnis = MsgBox(F0006, vbOKOnly, "Code No. 0006")
Exit Sub
End If
ze = 23: sp = 3
If IsEmpty(Cells(23, 3)) Then
MsgBox ("Leer !!!")
Exit Sub
End If
If ActiveSheet.FilterMode Then
ActiveSheet.ShowAllData
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
ActiveWindow.ScrollRow = 1
ActiveWindow.ScrollColumn = 3
Range("c1:e21").Select
ReDim b_ze(1 To 500): b = 0 'Markierung Stoll 230 in 500 geändert
Do While Not IsEmpty(Cells(ze, sp))
G = UCase(Cells(ze, 3))
Cells(ze, 3) = G
If Cells(ze, sp) = "P" Then
Cells(ze, 7) = "=roundup(r[0]c[80],0)"
G1 = UCase(Cells(ze, 11))
Cells(ze, 11) = G1
If G1 = "C" Or G1 = "F" Or G1 = "D" Or G1 = "" Then
Else
Ergebnis = MsgBox(F0009, vknurok, "Code No. 0009")
Cells(ze, 11).Activate
Exit Sub
End If
ElseIf Cells(ze, sp) = "B" Then
If Cells(ze, 6) = 0 Or Cells(ze, 6) = "" Then
Ergebnis = MsgBox(F0008, vknurok, "Code No. 0008")
Cells(ze, 6).Activate
Exit Sub
End If
b = b + 1
b_ze(b) = ze
Else
Ergebnis = MsgBox(F0007, vknurok, "Code No. 0007")
Cells(ze, 3).Activate
Exit Sub
End If
ze = ze + 1
Loop 'Until IsEmpty(Cells(ze, sp))
If b > 0 Then
ReDim Preserve b_ze(1 To b)
End If
ze = ze - 1
'*********************************************************************************
With Range(Cells(23, 3), Cells(ze, 87))
With .Interior
.ColorIndex = xlAutomatic
.Pattern = xlSolid
End With
With .Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlNone
.ColorIndex = xlAutomatic
End With
If ze > 23 Then
With .Borders(xlInsideHorizontal)
.Weight = xlHairline
.ColorIndex = 11
End With
End If
With .Borders(xlEdgeBottom)
.Weight = xlHairline
.ColorIndex = 11
End With
With .Borders(xlInsideVertical)
.Weight = xlHairline
.ColorIndex = 11
End With
End With
With Range(Cells(23, 2), Cells(ze, 2))
With .Interior
.ColorIndex = 20
.Pattern = xlSolid
End With
With .Borders(xlRight)
.Weight = xlMedium
.ColorIndex = 11
End With
End With
For s = 15 To 21 Step 3
With Range(Cells(23, s), Cells(ze, s)).Borders(xlRight)
.Weight = xlMedium
.ColorIndex = 11
End With
Next
With Range(Cells(23, 87), Cells(ze, 87))
With .Borders(xlLeft)
.Weight = xlMedium
.ColorIndex = 11
End With
With .Interior
.ColorIndex = 19
.Pattern = xlSolid
End With
With .Borders(xlRight)
.Weight = xlMedium
.ColorIndex = 11
End With
End With
For x = 1 To b
With Range(Cells(b_ze(x), 3), Cells(b_ze(x), 86))
With .Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlNone
.ColorIndex = 3
End With
With .Interior
.ColorIndex = 40
.Pattern = xlSolid
End With
End With
Next
'*********************************************************************************
Sheets("allgemein").Select
Range("A1").Select
Application.ScreenUpdating = True
End Sub