Current location - Loan Platform Complete Network - Big data management - excel how to use vba to achieve a certain column limit input range
excel how to use vba to achieve a certain column limit input range
excel how to use vba to achieve a certain column to limit the input range of the solution is as follows:

1, open the excel document to be processed,

2, press alt + f11, open the vba editing window,

3, double-click on the left side of the tree in the thatsheet,

4, in the right-hand side of a blank window, enter the following:

Private Sub Worksheet_Change(ByVal Target As Range)

Dim s As String

Dim i As Long, j As Long

Dim LL As String

LL = "D" 'Column to be controlled

Dim cc As Range

For Each cc In Target

If InStr(1, cc.Address, LL) > 0 Then

s = cc.Value2

'MsgBox s< /p>

If s = "Text" Or s = "Number" Or s = "Date" Then

Else

cc.ClearContents

End If

End If

Next

End Sub