Ask Your Question
0

Is there a possibility to get current topmost row shown via macro in calc?

asked 2019-08-11 23:06:23 +0200

Reth gravatar image

Hi there,

is there any way to get the currently first row shown at display determined via macro? If so - how can this be done?

Thank you in advance!

Bye

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-08-12 05:07:10 +0200

Lua gravatar image

updated 2019-08-12 16:43:34 +0200

If I understand what you mean, the code below selects first row and colors it with gray.

Sub ColorFirstRow
 Dim firstRow
 firstRow = ThisComponent.Sheets.getByIndex(0).Rows(0)
 firstRow.CellBackColor = RGB(225, 225, 225)
End Sub
edit flag offensive delete link more

Comments

Thank you. Unfortunately this only seems to work as long as no other row is selected. As soon as another row is clicked that one gets selected by this code.

Is there also a way to get the current visible topmost row regardless which other row might be selected?

Reth gravatar imageReth ( 2019-08-12 07:58:00 +0200 )edit

I just made changes to third line. Please let me know if it suits or not what you are looking for.

Lua gravatar imageLua ( 2019-08-12 16:45:54 +0200 )edit

This will always select the row with index 0 - regardless whether it is displayed or not. I am looking for something which shows me the first (well better second since I froze first line) currently visible row! So if let's say currently row 0 is topmost row visible I want to determine 0, if I now scroll down entire sheet for 10 lines I want to get 10, after scrolling down another 8 lines I want to get 18 - and so on and so forth; same for scrolling up again).

Reth gravatar imageReth ( 2019-08-13 01:00:55 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-08-11 23:06:23 +0200

Seen: 51 times

Last updated: Aug 12