Roderick_E
Well-known Member
- Joined
- Oct 13, 2007
- Messages
- 2,051
Ugh,
I rely on the bit of code below all the time to find the last cell but the problem is, my company has some people using Excel & some using OpenOffice Calc.
1 Dim LastRow As Long, i As Long
2 LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
3 For i = LastRow To 6 Step -1 'row 5, in this case is the header row.
4 With Rows(i)
5 'do stuff here
6 End With
7 Next i
Calc doesn't like line 2 & crashes. (object issues) Does anyone have a simple piece of OpenOffice code that will do this same thing? Thanks.
P.S.
Oh it would be cool too if someone had a bit of code that I can place in ALL of my macros that first determined if the person was running the macro under Excel or OpenOffice, that way I could call the appropriate macros
Thanks
I rely on the bit of code below all the time to find the last cell but the problem is, my company has some people using Excel & some using OpenOffice Calc.
1 Dim LastRow As Long, i As Long
2 LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
3 For i = LastRow To 6 Step -1 'row 5, in this case is the header row.
4 With Rows(i)
5 'do stuff here
6 End With
7 Next i
Calc doesn't like line 2 & crashes. (object issues) Does anyone have a simple piece of OpenOffice code that will do this same thing? Thanks.
P.S.
Oh it would be cool too if someone had a bit of code that I can place in ALL of my macros that first determined if the person was running the macro under Excel or OpenOffice, that way I could call the appropriate macros
Thanks