A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Auto Capital Letter in a cell



 
 
Thread Tools Display Modes
  #1  
Old January 7th, 2008, 01:29 PM posted to microsoft.public.excel.worksheet.functions
Montu
external usenet poster
 
Posts: 48
Default Auto Capital Letter in a cell

I have designed my worksheet by using format "Merge Cell" like
A B C D E F G H I
J K
1 PAN NO. ABCDEF1234G TAN NO. VWXY012345Z
From B1 to E1 & G1 to K1 is formated cell "Merge". I want whenever write in
B1 or G1 it will be automatically Capital Letter. For this purpose I asked
for help & got a VBA code from this forum & also have used to my worksheet
(by pressing Alt+f11). The code is as follows -
Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("b1:E1")
r = Range("g1:k1")
Application.EnableEvents = False
If Application.WorksheetFunction.IsText(r) Then
r.Value = UCase(r.Value)
End If
Application.EnableEvents = True
End Sub
But it's not working means it's not being automatic capital letter. Help me
what should I do.
  #2  
Old January 7th, 2008, 02:20 PM posted to microsoft.public.excel.worksheet.functions
Bernie Deitrick
external usenet poster
 
Posts: 2,496
Default Auto Capital Letter in a cell

Montu,

Try it this way:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B1,G1")) Is Nothing Then Exit Sub
If Target.Cells.Count 1 Then Exit Sub
Application.EnableEvents = False
If Application.WorksheetFunction.IsText(Target.Value) Then
Target.Value = UCase(Target.Value)
End If
Application.EnableEvents = True
End Sub

HTH,
Bernie
MS Excel MVP


"Montu" wrote in message
...
I have designed my worksheet by using format "Merge Cell" like
A B C D E F G H I
J K
1 PAN NO. ABCDEF1234G TAN NO. VWXY012345Z
From B1 to E1 & G1 to K1 is formated cell "Merge". I want whenever write in
B1 or G1 it will be automatically Capital Letter. For this purpose I asked
for help & got a VBA code from this forum & also have used to my worksheet
(by pressing Alt+f11). The code is as follows -
Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("b1:E1")
r = Range("g1:k1")
Application.EnableEvents = False
If Application.WorksheetFunction.IsText(r) Then
r.Value = UCase(r.Value)
End If
Application.EnableEvents = True
End Sub
But it's not working means it's not being automatic capital letter. Help me
what should I do.



  #3  
Old January 8th, 2008, 05:25 AM posted to microsoft.public.excel.worksheet.functions
Montu
external usenet poster
 
Posts: 48
Default Auto Capital Letter in a cell

I have copy & past of this code to Excel Visual Basic Editor. But it's not
working. should I creat shortcut key ?. I want it will be automatically
capital letter with in the range, How would be it possible. help me thanks in
advance.

"Bernie Deitrick" wrote:

Montu,

Try it this way:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B1,G1")) Is Nothing Then Exit Sub
If Target.Cells.Count 1 Then Exit Sub
Application.EnableEvents = False
If Application.WorksheetFunction.IsText(Target.Value) Then
Target.Value = UCase(Target.Value)
End If
Application.EnableEvents = True
End Sub

HTH,
Bernie
MS Excel MVP


"Montu" wrote in message
...
I have designed my worksheet by using format "Merge Cell" like
A B C D E F G H I
J K
1 PAN NO. ABCDEF1234G TAN NO. VWXY012345Z
From B1 to E1 & G1 to K1 is formated cell "Merge". I want whenever write in
B1 or G1 it will be automatically Capital Letter. For this purpose I asked
for help & got a VBA code from this forum & also have used to my worksheet
(by pressing Alt+f11). The code is as follows -
Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("b1:E1")
r = Range("g1:k1")
Application.EnableEvents = False
If Application.WorksheetFunction.IsText(r) Then
r.Value = UCase(r.Value)
End If
Application.EnableEvents = True
End Sub
But it's not working means it's not being automatic capital letter. Help me
what should I do.




  #4  
Old January 8th, 2008, 02:12 PM posted to microsoft.public.excel.worksheet.functions
Bernie Deitrick
external usenet poster
 
Posts: 2,496
Default Auto Capital Letter in a cell

Montu,

Copy the code, right-click the sheet tab of interest, select "View Code" and paste the code into the
window that appears. The code is an event, which does not go into a regular codemodule, but into
the codemodule of the worksheet.

HTH,
Bernie
MS Excel MVP


"Montu" wrote in message
...
I have copy & past of this code to Excel Visual Basic Editor. But it's not
working. should I creat shortcut key ?. I want it will be automatically
capital letter with in the range, How would be it possible. help me thanks in
advance.

"Bernie Deitrick" wrote:

Montu,

Try it this way:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B1,G1")) Is Nothing Then Exit Sub
If Target.Cells.Count 1 Then Exit Sub
Application.EnableEvents = False
If Application.WorksheetFunction.IsText(Target.Value) Then
Target.Value = UCase(Target.Value)
End If
Application.EnableEvents = True
End Sub

HTH,
Bernie
MS Excel MVP


"Montu" wrote in message
...
I have designed my worksheet by using format "Merge Cell" like
A B C D E F G H I
J K
1 PAN NO. ABCDEF1234G TAN NO. VWXY012345Z
From B1 to E1 & G1 to K1 is formated cell "Merge". I want whenever write in
B1 or G1 it will be automatically Capital Letter. For this purpose I asked
for help & got a VBA code from this forum & also have used to my worksheet
(by pressing Alt+f11). The code is as follows -
Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("b1:E1")
r = Range("g1:k1")
Application.EnableEvents = False
If Application.WorksheetFunction.IsText(r) Then
r.Value = UCase(r.Value)
End If
Application.EnableEvents = True
End Sub
But it's not working means it's not being automatic capital letter. Help me
what should I do.






 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:37 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.