이 코드는 주로 원하는 작업을 수행해야합니다. 조치를 취할 워크 시트의 코드 시트에이를 설치하십시오. 해당 시트에는 선택란이 필요하지 않습니다. 코드가이를 작성하고 있습니다. 그러나 원하는 방식으로 숫자 (체크 박스가 아닌)를 표시하려면 해당 시트의 셀을 포맷해야합니다.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
' 01 Oct 2017
Dim Rng As Range
On Error GoTo ErrExit
If Target.Cells.Count > 1 Then Exit Sub
' Specify the range where you want checkboxes to appear when clicked:-
' the range is defined as starting from C2 end ending
' at the cell in column F in the last used row in column A
' if column A has a fixed number of entries, like "Point 1 to Point 5"
' "Cells(Rows.Count, "A").End(xlUp).Row" may be replaced by a fixed row number
Set Rng = Range(Cells(2, "C"), _
Cells(Cells(Rows.Count, "A").End(xlUp).Row, "F"))
On Error GoTo 0
If Not Application.Intersect(Target, Rng) Is Nothing Then
With Target
Set Rng = Range(Cells(.Row, Rng.Column), _
Cells(.Row, Rng.Column + Rng.Columns.Count))
Rng.ClearContents
' Column "B" is "Total selected"
' it is assigned the value from row 1
Cells(.Row, "B").Value = Cells(1, .Column).Value
.Font.Name = "Wingdings"
.Font.Size = 14 ' set the font size as required
.HorizontalAlignment = xlCenter
.Value = ChrW(254)
End With
End If
Exit Sub
ErrExit:
' the likely reason is that column A is blank.
' Make sure that there is an entry in column A
' for every row in which you may want to set a checkbox
MsgBox Err & vbCr & Err.Description, _
vbCritical, "Malfunction"
End Sub
"총중량"열에 갖고 싶은 것을 이해하지 못했습니다. 워크 시트 함수로 해당 열을 채울 수 있습니다.
안녕하십니까, 답변 해 주셔서 감사합니다. 나는이 코드를 사용했다 : – Mahra
코드가 당신의 목적에 부합한다면 대답을 "selected"로 표시해라. 그렇지 않으면 개선이 필요한 부분을 알려주고 도와 드리겠습니다. – Variatus