ferguson_jerald
asked on
How can I get this macro to work with libreoffice calc?
Hello Experts.
I have the following macro that works with Excel, but I would like to have a version that works with libreOffice as well. I get an error with "dim r as Range" when I try to run it in libreOffice Calc. It says "Basic syntax error. Unknown data type Range". Here's the macro:
Any help would be greatly appreciated.
I have the following macro that works with Excel, but I would like to have a version that works with libreOffice as well. I get an error with "dim r as Range" when I try to run it in libreOffice Calc. It says "Basic syntax error. Unknown data type Range". Here's the macro:
Sub RemoveSelectColumns()
Dim iColumn As Integer
Dim strCell As String
Dim strColumnName As String
Dim r As Range
iColumn = 1
Do
strCell = Cells(1, iColumn).Value
If strCell = "" Then
Exit Do
End If
If UCase(strCell) = "MOE" Then
' case-independent
strColumnName = Split(Cells(1, iColumn).Address, "$")(1)
Columns(strColumnName & ":" & strColumnName).Delete Shift:=xlToLeft
Else
iColumn = iColumn + 1
End If
Loop
End Sub
Any help would be greatly appreciated.
Delete line 5. You never use r anyway.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
oSheets = ThisComponent.getSheets()
r
= oSheet.getCellRangeByName(
for example.