0
value = "Choose"일 때 데이터 유효성 검사 목록을 추가하고 다른 모든 값은 문자 제한을 추가 할 셀 범위 (B5 : B61)가 있습니다. 셀의 캐릭터 라인의 길이문자 제한을 셀 값과 동일하게 설정하십시오.
코드는 데이터 유효성 검사 목록 및 텍스트 길이를 추가하는 데 사용됩니다. 그러나 formula2 = 셀의 값의 문자열 길이를 어떻게 만들 수 있습니까?
Sub Attribute_Options_Cell_Validation()
For Each cell In Range("B5:B61").Cells
With cell
.Formula = "=myformula"
.Value = .Value
If cell = "Choose" Then
With .Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=new_DDM3"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Else
With .Validation
.Delete
.Add Type:=xlValidateTextLength, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="1", Formula2:="20"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
End If
End With
Next cell
End Sub
은 완벽하게 작동하고, 더 나은 그 이유를 이해합니다. – Astr0zombi3s