Boa noite, existe uma macro (basic para calc) que ao selecionar determinada célula mostre o seu conteúdo, bem como como de células adjacentes. Ex.: Selecionado a célula A1 (valor mostrado é Animais) e as adjacentes, no caso, A2 (valor mostrado é Macaco) e A3 (valor mostrado é Girafa).
Explique melhor, pois se você estiver na célula A1, A2 e A3 já estão visíveis !!!
Tem arquivo de exemplo ?
,
Sub PegarStringDaCelulaAtual()
Dim oSel as Object
oSel = ThisComponent.getCurrentSelection()
Var1 = oSel.getString()
Var2 = 'a posição esquerda seguinte da Var1
Msgbox Var1 & " - " & Var2
End Sub
.
Sub Main
MsgBox ThisComponent.Sheets(0).GetCellRangeByName("A1").Value
MsgBox ThisComponent.Sheets(0).GetCellRangeByName("A2").Value
MsgBox ThisComponent.Sheets(0).GetCellRangeByName("A3").Value
End Sub
Seria isto?
.
Sub PegarStringDaCelulaAtual()
Dim oSel as Object
oSel = ThisComponent.getCurrentSelection()
Var1 = oSel.getString()
Var2 = 'a posição esquerda seguinte da Var1
Msgbox Var1 & " - " & Var2
End Sub
.
.
Segue um exemplo: Pega a string da célula atual e a esquerda dela.
Sub PegarStringDaCelulaAtualEEsquerda()
Dim document As Object
Dim dispatcher As Object
Dim oSel as Object
oSel = ThisComponent.getCurrentSelection()
Var1 = oSel.getString()
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(1) as new com.sun.star.beans.PropertyValue
args1(0).Name = "By"
args1(0).Value = 1 '<==== quantidade colunas deslocadas no cursor.
args1(1).Name = "Sel"
args1(1).Value = false
dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args1())
oSel = ThisComponent.getCurrentSelection()
Var2 = oSel.getString()
Msgbox Var1 & " - " & Var2
End Sub