Spero di essere stata chiara in questo esempio un pò ingarbugliato

Moderatori: Anthony47, Flash30005
Sub GimmePredec()
'Elenca i Predecessor della ActiveCell
Dim PiPP As Range, cPos As Range, tWS As String, tWB As String, cCell As String
Dim pAdr As String, flExt As Boolean, I As Long, mySplit, J As Long, K As Long
Dim kArr(1 To 10, 1 To 2, 1 To 10), Mess As String
Dim Rispo, L As Long, lWB As String
'
Set cPos = ActiveCell
tWB = ThisWorkbook.Name
tWS = ActiveSheet.Name
cCell = ActiveCell.Address(0, 0, 1, True)
ActiveSheet.ClearArrows
ActiveCell.ShowPrecedents
For I = 1 To 10
For J = 1 To 10
reExt:
Application.Goto cPos
Set PiPP = Nothing
On Error Resume Next
Set PiPP = ActiveCell.NavigateArrow(True, I, J)
On Error GoTo 0
If PiPP Is Nothing Then
flExt = False
Else
If PiPP.Address(0, 0, 1, True) = cPos.Address(0, 0, 1, True) Then
'nulla?
Else
pAdr = Replace(PiPP.Address(0, 0, 1, True), "[" & tWB & "]", "", , , vbTextCompare)
If ActiveSheet.Name = tWS Then
pAdr = Replace(pAdr, tWS & "!", "", , , vbTextCompare)
pAdr = Replace(pAdr, tWS & "'!", "", , , vbTextCompare)
End If
pAdr = Replace(pAdr, "'", "", , , vbTextCompare)
kArr(I, 1, J) = pAdr
kArr(I, 2, J) = PiPP.Text
'Debug.Print pAdr, PiPP.Text
End If
End If
Next J
Next I
'
Mess = ""
For K = 1 To 10
For J = 1 To 10
If kArr(K, 1, J) <> "" Then
L = L + 1
Mess = Mess & vbCrLf & L & ", " & kArr(K, 1, J) & ", " & kArr(K, 2, J)
End If
Next J
Next K
If Len(Mess) < 5 Then
Application.Goto cPos
MsgBox ("La cella non ha PRECEDENTI")
GoTo EXT
End If
Mess = Mess & vbCrLf & "Numero del link? (oppure Annulla)"
Rispo = Application.InputBox(Mess, "Scegli link:")
'
If Rispo = False Or Rispo = "" Or Rispo > UBound(kArr, 1) Then
GoTo EXT
End If
mySplit = Split(Mess & " ", vbCrLf, , vbTextCompare)
For I = 0 To UBound(mySplit)
lWB = ""
If Left(mySplit(I), Len(Rispo)) = Rispo Then
If InStr(1, mySplit(I), "]", vbTextCompare) > 0 Then
lWB = Replace(Split(mySplit(I), "]", , vbTextCompare)(0), "[", "", , , vbTextCompare)
lWB = Trim(Replace(lWB, Rispo & ",", "", , , vbTextCompare))
End If
mySplit = Split(Split(Replace(mySplit(I), "[" & lWB & "]", "", , , vbTextCompare) & " ", ",", , vbTextCompare)(1) & " ", "!", , vbTextCompare)
If UBound(mySplit) = 1 Then
If lWB = "" Then
Set PiPP = Sheets(Trim(mySplit(0))).Range(Trim(mySplit(1)))
Else
Set PiPP = Workbooks(lWB).Sheets(Trim(mySplit(0))).Range(Trim(mySplit(1)))
End If
Application.Goto PiPP
GoTo EXT
Else
Application.Goto Range(Trim(mySplit(0)))
GoTo EXT
End If
End If
Next I
Application.Goto cPos
MsgBox ("Il link scelto non esiste")
EXT:
Workbooks(tWB).Sheets(tWS).ClearArrows
End Sub
Application.Goto Replace(ActiveCell.FormulaR1C1, "=", ""), True
Torna a Applicazioni Office Windows
Aumenta altezza riga in base valore cella Autore: trittico69 |
Forum: Applicazioni Office Windows Risposte: 47 |
Importare immagini a seconda del testo in una cella Autore: Paolo67met |
Forum: Applicazioni Office Windows Risposte: 4 |
Inserire valore di una cella in altra cella con testo Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 17 |
Macro crea file word rinominato come dato in specifica cella Autore: systemcrack |
Forum: Applicazioni Office Windows Risposte: 11 |
Visitano il forum: Nessuno e 118 ospiti