Sub WerteLaden()
Dim Pfad$, vImp$, arrA(), arrB(), arrC(), arrD(), arrE, arrF()
Pfad = Application.GetOpenFilename("Excel Files (*.xlsx), *.xls", , "XLSx", "Auswahl", _
False)
If TypeName(Pfad) Like "Boolean" Then
MsgBox "Keine Datei gewählt!", vbInformation
Exit Sub
Else
Workbooks.Open Pfad
vImp = Right$(Pfad, Len(Pfad) - InStrRev(Pfad, "\"))
With Workbooks(vImp).Sheets("Tabelle1")
arrA = .Range("B5:C9").Value
arrB = .Range("B15:C15").Value
arrC = .Range("D18:F19").Value
arrD = .Range("G24:I26").Value
.Range("G31:G33,G36:G38").NumberFormat = "General"
arrE = .Range("G31:H33").Value
arrF = .Range("G36:H38").Value
Application.DisplayAlerts = False
Workbooks(vImp).Close
Application.DisplayAlerts = True
End With
End If
With Tabelle3
.Unprotect Password:="Test"
.Cells(3, 2).Resize(5, 2) = arrA
.Protect Password:="Test"
End With
With Tabelle1
.Unprotect Password:="Test"
.Cells(4, 2).Resize(1, 2) = arrB
.Cells(7, 4).Resize(2, 3) = arrC
.Cells(13, 7).Resize(3, 3) = arrD
.Cells(20, 7).Resize(3, 2) = arrE
.Cells(25, 7).Resize(3, 2) = arrF
.Protect Password:="Test"
End With
End Sub
Sub WerteLaden()
Dim Pfad$, vImp$, arrA(), arrB(), arrC(), arrD(), arrE, arrF(), dateUp As Date
Pfad = Application.GetOpenFilename("Excel Files (*.xlsx), *.xls", , "XLSx", "Auswahl", _
False)
If TypeName(Pfad) Like "Boolean" Then
MsgBox "Keine Datei gewählt!", vbInformation
Exit Sub
Else
Workbooks.Open Pfad
vImp = Right$(Pfad, Len(Pfad) - InStrRev(Pfad, "\"))
With Workbooks(vImp).Sheets("Tabelle1")
dateUp = .Range("B1")
arrA = .Range("B5:C9").Value
arrB = .Range("B15:C15").Value
arrC = .Range("D18:F19").Value
arrD = .Range("G24:I26").Value
.Range("G31:G33,G36:G38").NumberFormat = "General"
arrE = .Range("G31:H33").Value
arrF = .Range("G36:H38").Value
Application.DisplayAlerts = False
Workbooks(vImp).Close
Application.DisplayAlerts = True
End With
End If
With Tabelle3
.Unprotect Password:="Test"
.Cells(1, 2) = dateUp
.Cells(3, 2).Resize(5, 2) = arrA
.Protect Password:="Test"
End With
With Tabelle1
.Unprotect Password:="Test"
.Cells(4, 2).Resize(1, 2) = arrB
.Cells(7, 4).Resize(2, 3) = arrC
.Cells(13, 7).Resize(3, 3) = arrD
.Cells(20, 7).Resize(3, 2) = arrE
.Cells(25, 7).Resize(3, 2) = arrF
.Protect Password:="Test"
End With
End Sub
Sub Update()
Dim Pfad, vImp$, arrA(), arrB(), arrC(), arrD(), arrE, arrF(), dateUp As Date
Pfad = Application.GetOpenFilename("Excel Files (*.xlsx), *.xls", , "XLSx", "Auswahl", _
False)
If TypeName(Pfad) Like "Boolean" Then
MsgBox "Keine Datei gewählt!", vbInformation
Exit Sub
Else
Application.EnableEvents = False
Workbooks.Open Pfad
vImp = Right$(Pfad, Len(Pfad) - InStrRev(Pfad, "\"))
With Workbooks(vImp).Sheets("Tabelle1")
dateUp = .Range("B1") 'Updatestand
arrA = .Range("B66:C72").Value 'Baukostenindes usw.
arrB = .Range("D5:E5").Value 'Beitragssätze
arrC = .Range("D19:F20").Value 'Glas
arrD = .Range("F33:H35").Value 'HuG
.Range("F51:F53,F56:F58").NumberFormat = "General"
arrE = .Range("F51:H53").Value 'GSH oberirdisch
arrF = .Range("F56:H58").Value 'GSH unterirdisch
Application.DisplayAlerts = False
Application.EnableEvents = True
Workbooks(vImp).Close
Application.DisplayAlerts = True
End With
End If
With Tabelle5
.Unprotect Password:="Test"
.Cells(1, 2) = dateUp
.Cells(3, 2).Resize(5, 2) = arrA
.Protect Password:="Test"
End With
With Tabelle1
.Unprotect Password:="Test"
.Cells(4, 2).Resize(1, 2) = arrB
.Cells(7, 4).Resize(2, 3) = arrC
.Cells(13, 7).Resize(3, 3) = arrD
.Cells(20, 7).Resize(3, 2) = arrE
.Cells(25, 7).Resize(3, 2) = arrF
.Protect Password:="Test"
End With
End Sub