A noob needs some guidance [to clearly display the strings of text in the cell that i select]

I guess I’m sorry (?) for asking something that I thought was clear. Since people seemed to not like how in-experienced I was I assumed people would not care for the AI slop solution.

Let’s go over this in more detail

Explainer on what I’m doing:
I don’t think I’m using this program in it’s classical “intended” way. I’m simply using it as a visual way to display the EAN codes of products on shelves in a warehouse. The whole “table” of cells is always visible and all that’s gonna be done is that up to 4 lines of numbers will be stored in each cell for me to Ctrl + F my way to. It’s just to track where I put everything more effectively. I’m not doing any actual calculations or such.

Why no ods:
I didn’t upload the ods because the sheet is in Swedish and I simply didn’t wanna have to go through the trouble of translating it to English to upload here. I thought (wrongly) that it would just be an easy copy/paste when some pro drops the seemingly simple macro. I guess in the end my ask really was to abstract for a forum about calc. I’ll drop the ods though I won’t translate it cause the text really doesn’t matter for understanding the problem and solution in the end. Just didn’t wanna confuse people but no ods seems to have been more confusing.

Jobbet test.ods (35.2 KB)

I expected an answer with a copy/paste macro solution but I got way more than I could chew. I did see Shiavinatto’s answer and was gonna try but then I noticed mine worked and decided on good enough. The rest I could not begin to think about how to interpret/test… mb?

Oh and I skipped on have the numbers be invisible cause it didn’t work with the macro and wasn’t fully necessary in the end. Though I’d love suggestions. But the cell must auto-update with the active cell since I want it to work with the auto-select from a Ctrrl + F search.

Seeing as some are keen on knowing the solution I’m gonna post the macro that ended up working all along below incase you don’t wanna check the ods.

Sub ShowActiveCell(oEvent)
    oSheet = ThisComponent.CurrentController.ActiveSheet
    'Replace "A1" with your target cell address
    oTargetCell = oSheet.getCellRangeByName("A1") 
    oActiveCell = ThisComponent.getCurrentSelection()

    If oActiveCell.supportsService("com.sun.star.sheet.SheetCell") Then
        oTargetCell.String = oActiveCell.String
    End If
End Sub

Solution: If it’s not the traditional way to use a program, use AI and through some trial and error you’ll get there :smile:

Hi @Sullivannn, if you format it as described at the beginning of the topic (;;;), it won’t work.

Sub ShowActiveCellGS 'Länkad till evenemanget, dubbelklicka

dim doc, dis as object

doc = ThisComponent.CurrentController.Frame
dis = createUnoService("com.sun.star.frame.DispatchHelper")
dis.executeDispatch(doc, ".uno:Copy", "", 0, Array())

rem ------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "ToPoint" : args2(0).Value = "$M$3"
dis.executeDispatch(doc, ".uno:GoToCell", "", 0, args2())
dis.executeDispatch(doc, ".uno:PasteOnlyText", "", 0, Array())

rem -------------------------------------------------
dim args21(0) as new com.sun.star.beans.PropertyValue
args21(0).Name = "ToPoint" : args21(0).Value = "$B$5"
dis.executeDispatch(doc, ".uno:GoToCell", "", 0, args21())

End Sub 'ShowActiveCellGS

Jobbet test_GS.ods (19,6,KB)

1 Like

Oh yea I forgot to include that I decided to skip the invisible numbers because of this and just choose to use line break or what it’s called in English.

The solution you posted is close but seems again I didn’t explain properly what I’m trying to do. What I’m trying to achieve is that when I use Ctrl + F to search for a number and the cell get’s automatically selected, then M3 should also automatically update with said numbers of the auto-selected cell. Would love to have it clean with no numbers but this is in the end not really necessary, it’s just to dummy-proof/make it cleaner for a work enviroment. Though I’d appreciate if you still had thoughts on how to solve this.

Thank you for the quick answer and even during holidays.

Ola @Sullivannn, segue sugestão, os dados estão ocultos, acione o botão “SEARCH”, preencha o texto de busca e de ok. Se encontrado, ira exibir em M3, e a célula com o conteúdo estará em evidencia.


Hi @Sullivannn, here’s a suggestion, the data is hidden, click the “SEARCH” button, fill in the search text and click ok. If found, it will display in M3, and the cell with the content will be highlighted.

Jobbet test_GS2.ods (27,6,KB)