Capitalize stock symbol Data Entry

ilcaa

Well-known Member
Joined
May 25, 2005
Messages
751
Office Version
  1. 365
Platform
  1. Windows
I have and order entry spreadsheet for trading that in cell A1 goes a stock symbol..ex yhoo

I want it to automatically capitalize upon entry so yhoo becomes YHOO but without hitting a macro command

i tried this with no success,

Public Property Get UpperA1() As Variant
Range("a1").Formula = Upper("a1")
End Property

still does not capitalize the entry in A1, any help with this?

thanks. M
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi

You'll probably be best off using a worksheet event - say you are only interested in what is entered in the A column (ie only the A column MUST be capitalised), then you could place the following in the sheet's Worksheet module:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("A:A"), Target) Is Nothing Then
    Target.Value = UCase(Target.Value)
End If
End Sub

Best regards

Richard
 
Upvote 0
works great but... i have a command button that resets the worksheet

(basically deletes all the entries so I can use it again with another symbol)

and when i hit that button and I get a debug error message on line
Target.Value = UCase(Target.Value)

anyway to reset the worksheet properly so when i use it again the Ucase command works over and over without the debug error?

thanks for the help
 
Upvote 0
Give this amended code a try:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("A:A"), Target) Is Nothing Then
    If Target.Cells.Count > 1 Then Exit Sub
    Target.Value = UCase(Target.Value)
End If
End Sub

Richard
 
Upvote 0
works like a charm, thanks for the help!
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,861
Members
449,052
Latest member
Fuddy_Duddy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top