Excel Code in Libre
Verfasst: Sa 11. Aug 2018, 10:23
Hallo Community,
ich habe einen funktionalen Code in Excel VBA und will diesen nun in Libre umsetzen.
Leider gibt es wohl einige Syntax-Probleme.
Vielleicht hat ja jemand Zeit und Muse sich dem Problem anzunehmen.
Der VBA-Code lautet:
Sub Druck()
Dim Spalte As Long
Dim Zeile As Long
Dim Zeilendifferenz As Long
Dim lngRow As Long
Dim rngCopy As Range
Spalte = 4 'Spalte für Bedingung
Zeile = 5 'Beginn zeile Bedingung
Zeilendifferenz = 5 'Zeile in Tabelle Druck (Einfügen Übertrag)
With Worksheets("Eingabe")
For lngRow = Zeile To 150
If .Cells(lngRow, Spalte) <> 0 Then
If rngCopy Is Nothing Then
Set rngCopy = .Rows(lngRow)
Else
Set rngCopy = Union(rngCopy, .Rows(lngRow))
End If
End If
Next
End With
If Not rngCopy Is Nothing Then
rngCopy.Copy
With Sheets("Kalkulation").Cells(Zeilendifferenz, 1)
.PasteSpecial Paste:=xlValues
.PasteSpecial Paste:=xlFormats
End With
Application.CutCopyMode = False
End If
Set rngCopy = Nothing
End Sub
Besten Dank!
ich habe einen funktionalen Code in Excel VBA und will diesen nun in Libre umsetzen.
Leider gibt es wohl einige Syntax-Probleme.
Vielleicht hat ja jemand Zeit und Muse sich dem Problem anzunehmen.
Der VBA-Code lautet:
Sub Druck()
Dim Spalte As Long
Dim Zeile As Long
Dim Zeilendifferenz As Long
Dim lngRow As Long
Dim rngCopy As Range
Spalte = 4 'Spalte für Bedingung
Zeile = 5 'Beginn zeile Bedingung
Zeilendifferenz = 5 'Zeile in Tabelle Druck (Einfügen Übertrag)
With Worksheets("Eingabe")
For lngRow = Zeile To 150
If .Cells(lngRow, Spalte) <> 0 Then
If rngCopy Is Nothing Then
Set rngCopy = .Rows(lngRow)
Else
Set rngCopy = Union(rngCopy, .Rows(lngRow))
End If
End If
Next
End With
If Not rngCopy Is Nothing Then
rngCopy.Copy
With Sheets("Kalkulation").Cells(Zeilendifferenz, 1)
.PasteSpecial Paste:=xlValues
.PasteSpecial Paste:=xlFormats
End With
Application.CutCopyMode = False
End If
Set rngCopy = Nothing
End Sub
Besten Dank!