我有這段代碼,它工作得很好。 唯一的問題是,我按下輸入後,例如在單元格「A2」中,而不是像往常一樣向下移動到單元格「A3」 - 它移動到單元格「E3」,所以它使得用戶難以類型。如何在使用Worksheet_Change時避免excel中單元格的移動事件
有什麼建議嗎?
Private Sub Worksheet_change(ByVal Target As Range)
Application.EnableEvents = False
Range("A2:M2").Interior.ColorIndex = 19
Dim LASTROW As Long
TheLastRow = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row
Dim intx As Variant
For i = 2 To TheLastRow
If Range("a" & i) = Range("a" & i + 1) Then
Range("A" & i + 1 & ":n" & i + 1).Interior.Color = Range("a" & i).Interior.Color
intx = intx + 0
Else
Range("A" & i + 1 & ":n" & i + 1).Interior.ColorIndex = 46 - intx
intx = intx + 1
End If
Next i
For i = 2 To TheLastRow
Range("e" & i).Select
ActiveCell.FormulaR1C1 = _
"=IF(ISBLANK(RC[-1]),"""",HYPERLINK(""PCDOCS://PCDOCS_JLM/""&RC[-1]&""/R"",""link""))"
Next i
Application.EnableEvents = True
End Sub
的偉大工程,謝謝! – ADIIDA