|
|
|
|
|
|
Excel
|
Change Case to Upper Case on Data Entry
|
|
Ease of Use
|
Easy
|
Version tested with
|
2000
|
Submitted by:
|
Anne Troy
|
Description:
|
Changes the case of text to upper case as soon as you type it and exit the cell.
|
Discussion:
|
Use this code to have your part numbers, state abbreviations, and other data properly entered as all upper case or all lower case, as the case may be. This code runs on a worksheet change event, and so must be stored in the file and worksheet in which you will use it.
|
Code:
|
instructions for use
|
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Application.Intersect(Target, Range("A1:A10")) Is Nothing Then
Target(1).Value = UCase(Target(1).Value)
End If
Application.EnableEvents = True
End Sub
|
How to use:
|
- Copy the code above.
- Open a workbook.
- Right-click the worksheet on which you'd like this code to operate, and hit View Code.
- Paste the code into the code window that appears at right.
- Change the range A1:A10 in the code to the range suitable for your file.
- Save the file, and close the Visual Basic Editor window.
|
Test the code:
|
- Type any text into the range of cells you chose in your code.
|
Sample File:
|
changecase.zip 7.3KB
|
Approved by mdmackillop
|
This entry has been viewed 207 times.
|
|