Sid*_*out 8 excel vba excel-vba
首先,我在15年的Excel编程中从未见过这样的东西.
在较轻松的音符上,我觉得这个特殊的Excel文件是闹鬼的:P
严肃地说,我真的无法理解发生了什么.
问题
代码(我没有写它)根据条件运行并隐藏行.当您单击除行C列以外的任何单元格时59,它会显示它来自行58.仅在单元格C中,它显示正确的地址.
截图

我试过了什么?
ScreenUpdating问题,但正如你可以看到代码,这被排除了.?Activecell.Row.我有58,59,58,58码
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
Run Code Online (Sandbox Code Playgroud)
杂项点数
正如您所看到的,该文件的列相反,因为它来自我在沙特阿拉伯的一个客户端.
我的问题
任何人都可以看到可能是什么问题?或者我应该简单地将其视为"罕见"的错误?
请检查合并单元格的行- 遍历它们会导致行"移位"
| 归档时间: |
|
| 查看次数: |
105 次 |
| 最近记录: |