ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cell tests for upper case, and certain #'s (https://www.excelbanter.com/excel-programming/327450-re-cell-tests-upper-case-certain-s.html)

Bob Phillips[_6_]

Cell tests for upper case, and certain #'s
 
Don't bother testing whether it is capital, just upshift regardless.

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:H10")) Is Nothing Then
With Target
.Value = UCase(.Value)
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Beth" wrote in message
...
How can you test a cell to determine whether the letter entered (since it
will only be a letter) is capital, and if it isn't then have it
automatically capitalized?
Next how can you test to see if the value entered is in a range of 5

options?
Thanks for your anticipated help.




Beth

Cell tests for upper case, and certain #'s
 
thanks it works great!!!!!!!

"Bob Phillips" wrote:

Don't bother testing whether it is capital, just upshift regardless.

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:H10")) Is Nothing Then
With Target
.Value = UCase(.Value)
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Beth" wrote in message
...
How can you test a cell to determine whether the letter entered (since it
will only be a letter) is capital, and if it isn't then have it
automatically capitalized?
Next how can you test to see if the value entered is in a range of 5

options?
Thanks for your anticipated help.






All times are GMT +1. The time now is 10:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com