snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
Sub ClsOverScore()
Dim lastRow As Long
Dim i As Long, r As Range, j As Long
With Worksheets("EvaAttib")
Set r = .Range("D8")
Do While r.Offset(i, 0).Value <> ""
i = i + 1
Loop
lastRow = r.Offset(i - 1, 0).Row
If Selection.Row <= lastRow Then
.Range(Selection, .Cells(lastRow, Selection.Column)).Value = ""
If Selection.Offset(0, 1).Locked Then Exit Sub
Selection.Offset(0, 1).Select
End If
End With
End Sub
จะต้องปรับโค๊ดอย่างไรครับ
You do not have the required permissions to view the files attached to this post.
'Other code
With Worksheets("EvaAttib")
Set r = .Range("D8")
Do While r.Offset(i, 0).Value <> ""
i = i + 1
Loop
.Range(r.Offset(i, 1), .Range("l" & .Rows.Count).End(xlUp)).ClearContents
' lastRow = r.Offset(i - 1, 0).Row
' If Selection.Row <= lastRow Then
' .Range(Selection, .Cells(lastRow, Selection.Column)).Value = ""
' If Selection.Offset(0, 1).Locked Then Exit Sub
' Selection.Offset(0, 1).Select
' End If
End With
'Other code