How to Restrict Lower Entries

4 views
Skip to first unread message

Pratibha Sharma

unread,
Aug 23, 2015, 11:39:58 PM8/23/15
to Excel VBA Lab
Dear Group,


I want to restrict Lower Case Entries in Column. How can i do it. Kindly help.



Rgds
PS

Ashish Bhalara

unread,
Aug 24, 2015, 1:30:39 AM8/24/15
to Excel VBA Lab
Hi Sharmaji,

Try below code to enter upper case value, just copy and paste in coding area of particular sheet.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Rng, R As Range
Dim i, j As Integer

Set Rng = Range("A1:A100") 'Change range as per requirement
If Not (Application.Intersect(Target, Rng) Is Nothing) Then
For Each R In Rng
    For i = 1 To Len(R)
        For j = 97 To 121
            If Mid(R, i, 1) = Chr(j) Then
                'Remove inverted comma (') from below two line to clear lower case value from cell range.
                'MsgBox "Lowe case not allowed in cell " & R.Address, vbOKOnly
                'R.Clear
                R = UCase(R) 'Transfer to Upper case in cell Range
            End If
        Next j
    Next i
Next R
End If

End Sub

Regards
Ashish Bhalara


--
www.ExcelVbaLab.com
---
You received this message because you are subscribed to the Google Groups "Excel VBA Lab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ExcelVbaLab...@googlegroups.com.
To post to this group, send email to Excel...@googlegroups.com.
Visit this group at http://groups.google.com/group/ExcelVbaLab.
To view this discussion on the web visit https://groups.google.com/d/msgid/ExcelVbaLab/21d87c12-135a-4024-a5a0-2b3246edc70a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vaibhav Joshi

unread,
Aug 24, 2015, 2:55:46 AM8/24/15
to Pratibha Sharma, Excel VBA Lab
Hi

Select cell A1 & then select column A & then in use data validation > Custom > Formula =EXACT(A1,UPPER(A1))

Cheers!!





On Mon, Aug 24, 2015 at 9:09 AM, Pratibha Sharma <pratibha....@gmail.com> wrote:

--

Ashish Bhalara

unread,
Aug 24, 2015, 4:53:10 AM8/24/15
to Excel VBA Lab
​It's accurate solution by data validation Vaibhavsir.​

Regards
Ashish Bhalara

Pratibha Sharma

unread,
Aug 24, 2015, 9:01:50 AM8/24/15
to Excel VBA Lab, excel...@googlegroups.com
Dear Ashish & Vaibhav Sir,


Thanks you so much. Both solutions are perfect to the requirement.

Thanks..!!



Rgds
PS
Reply all
Reply to author
Forward
0 new messages