Sub
Datenimport()
Dim
strInvoicePeriod
As
String
Dim
File
As
String
Dim
wkb
As
Excel.Workbook
strInvoicePeriod = InputBox(
"Which Invoice Period shall be imported? (e.g. 02-2020"
)
Do
Until
strInvoicePeriod <>
""
And
Len(strInvoicePeriod) = 7
strInvoicePeriod = InputBox(
"Please insert the following data! Which Invoice Period shall be imported? (e.g. 02-2020"
)
Loop
File = Application.GetOpenFilename()
On
Error
GoTo
ErrHandler
Application.ScreenUpdating =
False
Set
wkb = Workbooks.Open(File)
wkb.Sheets(1).Copy After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count).Name = strInvoicePeriod
wkb.Close
False
Application.ScreenUpdating =
True
lnglstSP = ThisWorkbook.Sheets(strInvoicePeriod).Cells(1, Columns.Count).
End
(xlToLeft).Column
ThisWorkbook.Sheets(strInvoicePeriod).Cells(1, lnglstSP).Offset(0, 1) =
"Mengendifferenz zur letzten Rechnung"
ThisWorkbook.Sheets(strInvoicePeriod).Cells(1, lnglstSP).Offset(0, 2) =
"Preis aus Materialpreisliste pro Tag"
ThisWorkbook.Sheets(strInvoicePeriod).Cells(1, lnglstSP).Offset(0, 3) =
"Gesamtpreis aus Materialpreisliste pro Tag"
ThisWorkbook.Sheets(strInvoicePeriod).Cells(1, lnglstSP).Offset(0, 4) =
"Stimmen Einzelpreise pro Tag aus Mietpreisliste und Rechnung überein?"
ThisWorkbook.Sheets(strInvoicePeriod).Cells(1, lnglstSP).Offset(0, 5) =
"Stimmen Gesamtpreise überein?"
MsgBox ActiveSheet.Cells.UsedRange &
" Zeilen "
& _
ActiveSheet.Cells.UsedRange &
" Spalten."
ErrHandler:
Application.EnableEvents =
True
Application.ScreenUpdating =
True
End
Sub
Public
Sub
FormelnSchreiben1()
Dim
oBlatt
As
Worksheet
Set
oBlatt = ThisWorkbook.Worksheets(
"Tabelle1"
)
With
oBlatt
.Range(
"u2"
).FormulaLocal =
"=Product(K2*R2)"
.Range(
"u3"
).FormulaLocal =
"=Product(K3*R3)"
End
With
Set
oBlatt =
Nothing
End
Sub