BITTE helfen Sie uns HEUTE mit einer SPENDE
Helfen Sie das LibreOffice Forum zu erhalten!

❤️ DANKE >><< DANKE ❤️

> KEINE WERBUNG FÜR REGISTRIERTE BENUTZER!<
Ihre Spende wird für die Deckung der laufenden Kosten sowie den Erhalt und Ausbau 🌱 des LibreOffice Forums verwendet.
🤗 Als Dankeschön werden Sie im Forum als LO-SUPPORTER gekennzeichnet. 🤗

My Conversion from VBA to Basic did not work properly - maybe theres another Attribute than Ranges?

Alles zur Programmierung im LibreOffice.
Antworten
TorbenIT
Beiträge: 9
Registriert: Do 1. Apr 2021, 10:32

My Conversion from VBA to Basic did not work properly - maybe theres another Attribute than Ranges?

Beitrag von TorbenIT » Di 6. Apr 2021, 09:58

Code: Alles auswählen

    Range("B9").Select
    Selection.Copy
    Range("A13").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("B6").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("B13").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("B7").Select
    Application.CutCopyMode = False
    Selection.Cut
    Range("C13").Select
    ActiveSheet.Paste
    Range("B8").Select
    Selection.Cut
    Range("D13").Select
    ActiveSheet.Paste
    Range("B7:B8").Select
    Selection.NumberFormat = "#,##0.00 $"
    Rows("13:13").Select
    Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
    Range("B13:D13").Select
    With Selection.Interior
        .Pattern = xlNone
        .TintAndShade = 0
        .PatternTintAndShade = 0
    End With
    Range("B6").Select

Code: Alles auswählen

Sub CopyKontoCell
	Dim bezeichnung as Variant
	oSheet1 = ThisComponent.Sheets.getByIndex(0) 'ThisComponent = ActiveWorkbook
	
	 REM Get the range to copy and the rang to copy to.
  	oRangeOrg = oSheet1.getCellRangeByName("B5").RangeAddress
  	oRangeCpy = oSheet1.getCellRangeByName("B19").RangeAddress
  	
  	
  	  REM Do the copy
 	 oSheet1.CopyRange(oCellCpy, oRangeOrg)
End Sub

Sub CopyDatumCell
	Dim inp as Variant
	oSheet1 = ThisComponent.Sheets.getByIndex(0)
	
	 REM Get the range to copy and the rang to copy to.
  	oRangeOrg = oSheet1.getCellRangeByName("B8").RangeAddress
  	oRangeCpy = oSheet1.getCellRangeByName("A19").RangeAddress
  	
  	  inp = oRangeCpy
  	
  	  inp = CDate(inp)
  	
  	  REM Do the copy
 	 oSheet1.CopyRange(oCellCpy, inp)
End Sub

Sub CopyEinnahmeCell
	Dim einnahme@
	oSheet1 = ThisComponent.Sheets.getByIndex(0)
	
	 REM Get the range to copy and the rang to copy to.
  	oRangeOrg = oSheet1.getCellRangeByName("B6").RangeAddress
  	oRangeCpy = oSheet1.getCellRangeByName("C19").RangeAddress
  	
  	einnahme@ = oRangeCpy
  	
  	  REM Do the copy
 	 oSheet1.CopyRange(oCellCpy, oRangeOrg)
End Sub

Sub CopyAusgabeCell
	oSheet1 = ThisComponent.Sheets.getByIndex(0)
	
	 REM Get the range to copy and the rang to copy to.
  	oRangeOrg = oSheet1.getCellRangeByName("B7").RangeAddress
  	oRangeCpy = oSheet1.getCellRangeByName("D19").RangeAddress
  	
  	  REM Do the copy
 	 oSheet1.CopyRange(oCellCpy, oRangeOrg)
End Sub

mikele
Beiträge: 1642
Registriert: Mo 1. Aug 2011, 20:51

Re: My Conversion from VBA to Basic did not work properly - maybe theres another Attribute than Ranges?

Beitrag von mikele » Di 6. Apr 2021, 14:26

Hallo,
hier https://de.openoffice.info/viewtopic.php?f=18&t=75399 geht es um etwas/das Gleiche.
Ein bisschen mehr Input wäre schon sinnvoll.
Gruß,
mikele

mikele
Beiträge: 1642
Registriert: Mo 1. Aug 2011, 20:51

Re: My Conversion from VBA to Basic did not work properly - maybe theres another Attribute than Ranges?

Beitrag von mikele » Di 6. Apr 2021, 14:42

Hallo,
da es (glaube ich) nur um das Übertragen von Inhalten geht, würde doch so etwas reichen:

Code: Alles auswählen

	oSheet1 = ThisComponent.Sheets.getByIndex(0)
	 oSheet1.getCellRangeByName("A19").String=oSheet1.getCellRangeByName("B8").String
bzw.

Code: Alles auswählen

	oSheet1 = ThisComponent.Sheets.getByIndex(0)
	 oSheet1.getCellRangeByName("A19").Value=oSheet1.getCellRangeByName("B8").Value
???
Gruß,
mikele

mikele
Beiträge: 1642
Registriert: Mo 1. Aug 2011, 20:51

Re: My Conversion from VBA to Basic did not work properly - maybe theres another Attribute than Ranges?

Beitrag von mikele » Di 6. Apr 2021, 14:57

Hallo,
um alle 4 Werte zu übertragen

Code: Alles auswählen

	osheet1=ThisComponent.Sheets.getByIndex(0)
	aDaten = oSheet1.getCellRangeByName("B5:B8").getDataArray()
	aDatenNeu=Array(Array(aDaten(3)(0),aDaten(0)(0),aDaten(1)(0),aDaten(2)(0)))
	oSheet1.getCellRangeByName("A19:D19").setDataArray(aDatenNeu())
Gruß,
mikele

TorbenIT
Beiträge: 9
Registriert: Do 1. Apr 2021, 10:32

Re: My Conversion from VBA to Basic did not work properly - maybe theres another Attribute than Ranges?

Beitrag von TorbenIT » Di 6. Apr 2021, 15:16

Ja, habes es mittlerweise selbst hinbekommen, aber danke dir!

Wie es aussieht, bist du ein Libre Office Basic Experte - willst du dir etwas dazu verdienen? Da ich noch mehrere Makros hätte, die in Basic übertragen müssten.

mikele
Beiträge: 1642
Registriert: Mo 1. Aug 2011, 20:51

Re: My Conversion from VBA to Basic did not work properly - maybe theres another Attribute than Ranges?

Beitrag von mikele » Di 6. Apr 2021, 16:14

Hallo,
für größere Projekte habe ich leider keine Zeit. Wir machen das hier rein privat aus Spaß an der Freude und als Hilfe zur Selbsthilfe.
Das, was du hier so beschrieben hast sind aber eher kleine Codeschnipsel - wie bereits geschrieben: ein bisschen mehr Input wäre hilfreich.
Gruß,
mikele

An alle, die das LibreOffice-Forum nutzen:


Bitte beteiligen Sie sich mit 7 Euro pro Monat und helfen uns bei unserem Budget für das Jahr 2024.
Einfach per Kreditkarte oder PayPal.
Als Dankeschön werden Sie im Forum als LO-SUPPORTER gekennzeichnet.

❤️ Vielen lieben Dank für Ihre Unterstützung ❤️

Antworten