Raaj Chauhan
New Member
- Joined
- Aug 1, 2015
- Messages
- 9
****** id="cke_pastebin" style="position: absolute; top: 0px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">
<tbody style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline;">
[TD="class: votecell"]
[TD="class: postcell"] I am currently using this macro to prevent users from entering similar entries within a spreadsheet. This is working fine in a single column. But how can I add similar in multiple columns (like Column A, D and F). Each column as to allow only unique records only. Please help me out
[/TD]
</tbody></body>
<tbody style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline;">
[TD="class: votecell"]
down votefavorite
[/TD]
[TD="class: postcell"] I am currently using this macro to prevent users from entering similar entries within a spreadsheet. This is working fine in a single column. But how can I add similar in multiple columns (like Column A, D and F). Each column as to allow only unique records only. Please help me out
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Column <> 1 Or .Cells.Count > 1 Then Exit Sub
If WorksheetFunction.CountIf(Columns(.Column), .Value) > 1 Then
Application.DisplayAlerts = False
.ClearContents
Application.DisplayAlerts = True
MsgBox "Aadhar no. already exists!"
End If
End With
End Sub
[/TD]
</tbody>
<tbody style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline;">
[TD="class: votecell"]
0down votefavorite
[/TD]
[TD="class: postcell"] I am currently using this macro to prevent users from entering similar entries within a spreadsheet. This is working fine in a single column. But how can I add similar in multiple columns (like Column A, D and F). Each column as to allow only unique records only. Please help me out
[/TD]
</tbody>
<tbody style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit; font-family: inherit; vertical-align: baseline;">
[TD="class: votecell"]
down votefavorite
[TD="class: postcell"] I am currently using this macro to prevent users from entering similar entries within a spreadsheet. This is working fine in a single column. But how can I add similar in multiple columns (like Column A, D and F). Each column as to allow only unique records only. Please help me out
Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Column <> 1 Or .Cells.Count > 1 Then Exit Sub
If WorksheetFunction.CountIf(Columns(.Column), .Value) > 1 Then
Application.DisplayAlerts = False
.ClearContents
Application.DisplayAlerts = True
MsgBox "Aadhar no. already exists!"
End If
End With
End Sub
[/TD]
</tbody>