Archive of Mr Excel Message Board


Back to Data in Excel archive index
Back to archive home

CAPS

Posted by Robb on February 06, 2002 10:59 AM
How do I restrict data entry on worksheets to CAPS? Do I use an API call? If so what is it? Thanx.

Re: CAPS

Posted by Mark O'Brien on February 06, 2002 11:52 AM
Why do you want to restrict data entry to be all CAPS?

If you are using VBA anyway you could use the "UCase" function to convert any text to all CAPS in your code and on the spreadsheet.

HTH


Data Validation

Posted by Steve Hartman on February 06, 2002 11:56 AM

Select all the cells. click Data > Validation. Choose Custom and enter =exact(upper(A1),A1). Click Ok


Re: Data Validation

Posted by Robb on February 06, 2002 12:32 PM

Thanx, but this is what I'm really looking for: User types in data onto my form and typed data is in UPPER CASE regardless if the Caps Lock is on or not. (I can do this in VB6 using an API call but not in Excel).


Re: CAPS - not what I needed - see comments

Posted by Robb on February 06, 2002 12:37 PM

Thanx, Yes, I'am using VBA. Why Caps you ask? Because my boss wants it that way.

This is what I'm looking for: User types in data onto my form and the typed data is in UPPER CASE regardless if the Caps Lock is on or not. (I can do this in VB6 using an API call but not in Excel).


Re: CAPS - not what I needed - see comments

Posted by Mark O'Brien on February 06, 2002 1:37 PM

If you can do this in VB6 using an API call then you should be able to use the same API call in VBA. The VB6 engine is actually based on VBA so any API functions should work in both.

OR. Perhaps more simply, I've created a userform and stuck on a text box, TextBox one and put this code in the change event:

Private Sub TextBox1_Change()
Me.TextBox1.Text = UCase(Me.TextBox1.Text)
End Sub

This would be cumbersome if you have a lot of textboxes on the form, but is definitely a means to an end.

Bosses can be a complete pain in the a**e.


This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.