Hello Everyone! I have a VBA macro that I need help converting to LibreOffice Basic. What the macro does is clear the content in a variable range and then display some dates in that same space. Here is the macro in VBA!
Further explanation about the macro:
This macro was created to select a range starting in cell A20 of the worksheet “Consultar” and the last cell should be the last one in collumn A that has content (that’s why it is a variable range).
After selecting this range the macro deletes its content.
Write Dates Part:
Here what it does is subtract to dates (G4 - G3 - 1 day) and this play the dates starting in cell A20 and going down. For example if G4 is 25/May/2018 and G3 is 21/May/2018 the macro displays in A20 21/May/2018; A21 22/May/2018; A22 23/May/2018; A23 24/May/2018. The date in G4 never appears in this range.
If you have any doubt about the macro let me know.
Thanks in advance for your help!
Sub WriteDates()
' Clear Contents
Dim sht As Worksheet
Dim LastRow As Long
Dim LastColumn As Long
Dim StartCell As Range
Set sht = Worksheets("Consultar")
Set StartCell = Range("A20")
' Find Last Row
LRow = sht.Cells(sht.Rows.Count, StartCell.Column).End(xlUp).Row
Range("A20:A" & LRow).ClearContents
' Write Dates
Dim rng As Range
Dim StartRng As Range
Dim EndRng As Range
Dim OutRng As Range
Dim StartValue As Variant
Dim EndValue As Variant
xTitleId = "KutoolsforExcel"
Set StartRng = Application.Selection
Set StartRng = Range("G3")
Set EndRng = Range("G4")
Set OutRng = Range("A20")
Set OutRng = OutRng.Range("A1")
StartValue = StartRng.Range("A1").Value
EndValue = EndRng.Range("A1").Value
If EndValue - StartValue <= 0 Then
Exit Sub
End If
ColIndex = 0
For i = StartValue To EndValue - 1
OutRng.Offset(ColIndex, 0) = i
ColIndex = ColIndex + 1
Next
End Sub