Per iniziare, non ho mai visto nulla di simile in 15 anni di programmazione Excel.Excel Row Mixup
Su una nota più leggera sento che questo particolare file di Excel è ossessionato: P
Su una nota seria, io davvero non riesco a capire cosa sta succedendo.
Problema
Il codice (non ho scritto io) viene eseguito e nasconde le righe in base a una condizione. Quando si fa clic su una cella qualsiasi tranne nella colonna C nella riga 59
, viene indicato che proviene dalla riga 58
. Solo nella cella C, mostra l'indirizzo corretto.
Schermata
Cosa ho provato?
- ho pensato che è un problema di
ScreenUpdating
, ma come si può vedere il codice, che questo è escluso. - Sono passato manualmente in tutte quelle celle a partire dal Col A al Col D e nella finestra Immediata digitato
?Activecell.Row
. Ho ottenuto58,59,58,58
- Controllato Google se qualcuno ha mai sperimentato questo tipo di problema. Ma non ho potuto trovare una singola istanza! Non so cos'altro potrebbe essere il problema.
Codice
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim i, j, k, lastrow As Long
Dim finlast As Long
Application.ScreenUpdating = False
'Income_Disc
lastrow = Sheets("Financial_Disc1").Range("E65536").End(xlUp).Row
finlast = Sheets("Financial_Disc").Range("A65536").End(xlUp).Value + 1
If Target.Column = 9 And Target.Row = 1 Then
'Unhide Rows if I1 is double clicked
Sheets("Financial_Disc1").Rows("1:65536").EntireRow.Hidden = False
Else
If Target.Row > 7 And Target.Row < lastrow Then
If Target.Column = 9 Then
'Hide Rows
For j = Target.Row To lastrow
If Sheets("Financial_Disc1").Range("B" & CStr(j + 1)) <> "" Then
'Hide Rows
Sheets("Financial_Disc1").Range("A" & CStr(j)).EntireRow.Hidden = True
Exit For
Else
'Hide Rows
Sheets("Financial_Disc1").Range("A" & CStr(j)).EntireRow.Hidden = True
End If
Next j
End If
End If
End If
Sheets("Financial_Disc1").Range("A8:A65536").ClearContents
For i = 8 To lastrow
If Sheets("Financial_Disc1").Range("A" & CStr(i)).EntireRow.Hidden = True Then
If Sheets("Financial_Disc1").Range("B" & CStr(i)) <> "" Then
Sheets("Financial_Disc1").Range("A" & CStr(i)) = ""
End If
Else
If Sheets("Financial_Disc1").Range("B" & CStr(i)) <> "" Then
Sheets("Financial_Disc1").Range("A" & CStr(i)) = finlast
finlast = finlast + 1
End If
End If
Next i
Application.ScreenUpdating = True
End Sub
Varie Punti
Come si può vedere questo file ha colonne in senso inverso, perché è da uno del mio cliente in Arabia Saudita.
La mia domanda
chiunque può vedere quello che potrebbe essere il problema? O dovrei semplicemente ignorarlo come un bug "raro"?
Avete delle celle unite? –
Studente di Gary! Sei una stella! Pubblicalo come risposta. Mi sento stupido perché non l'ho controllato! –
Non è nulla in confronto all'aiuto che mi hai dato con il problema * Nome Casella *! –