Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Convert text to upper case format

Hi All

I have prepared the code for the worksheet as follows. This code converts
the text to upper case format from any cell of the worksheet. Also it checks
for the specific text as well. This code works fine for all columns and rows
in the worksheet.
But I want to apply this code to column B only instead of whole worksheet.
Means whatever I will type in Column B should be changed to Uppercase and
also check for particular text, for example QUARTZ and SODA LIME.

Any help would be greatly appreciated.
Kind Regards
Harish


Private Sub Worksheet_Change(ByVal Target As Range)

If Target.HasFormula = True Then
Exit Sub
End If
If Target.Cells.Count 1 Then
Exit Sub
End If
Application.EnableEvents = False
Target.Value = UCase(Target.Text)
If Target.Value = "QUARTZ" Or Target.Value = "SODA LIME" Then

Else
MsgBox "Check the Spell"
Target.Select
End If
Application.EnableEvents = True

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Convert text to upper case format

if intersect(target, me.range("B:B")) is nothing then
exit sub
end if

(after the .cells.count check)

Harish wrote:

Hi All

I have prepared the code for the worksheet as follows. This code converts
the text to upper case format from any cell of the worksheet. Also it checks
for the specific text as well. This code works fine for all columns and rows
in the worksheet.
But I want to apply this code to column B only instead of whole worksheet.
Means whatever I will type in Column B should be changed to Uppercase and
also check for particular text, for example QUARTZ and SODA LIME.

Any help would be greatly appreciated.
Kind Regards
Harish

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.HasFormula = True Then
Exit Sub
End If
If Target.Cells.Count 1 Then
Exit Sub
End If
Application.EnableEvents = False
Target.Value = UCase(Target.Text)
If Target.Value = "QUARTZ" Or Target.Value = "SODA LIME" Then

Else
MsgBox "Check the Spell"
Target.Select
End If
Application.EnableEvents = True

End Sub


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Convert text to upper case format

Add this bit of code:

If Target.Column < 2 Then
Exit Sub
End If

RBS

"Harish" wrote in message
...
Hi All

I have prepared the code for the worksheet as follows. This code converts
the text to upper case format from any cell of the worksheet. Also it
checks
for the specific text as well. This code works fine for all columns and
rows
in the worksheet.
But I want to apply this code to column B only instead of whole worksheet.
Means whatever I will type in Column B should be changed to Uppercase and
also check for particular text, for example QUARTZ and SODA LIME.

Any help would be greatly appreciated.
Kind Regards
Harish


Private Sub Worksheet_Change(ByVal Target As Range)

If Target.HasFormula = True Then
Exit Sub
End If
If Target.Cells.Count 1 Then
Exit Sub
End If
Application.EnableEvents = False
Target.Value = UCase(Target.Text)
If Target.Value = "QUARTZ" Or Target.Value = "SODA LIME" Then

Else
MsgBox "Check the Spell"
Target.Select
End If
Application.EnableEvents = True

End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Convert text to upper case format

Thanks for your help.That works fine now.

Regards
Harish



"RB Smissaert" wrote:

Add this bit of code:

If Target.Column < 2 Then
Exit Sub
End If

RBS

"Harish" wrote in message
...
Hi All

I have prepared the code for the worksheet as follows. This code converts
the text to upper case format from any cell of the worksheet. Also it
checks
for the specific text as well. This code works fine for all columns and
rows
in the worksheet.
But I want to apply this code to column B only instead of whole worksheet.
Means whatever I will type in Column B should be changed to Uppercase and
also check for particular text, for example QUARTZ and SODA LIME.

Any help would be greatly appreciated.
Kind Regards
Harish


Private Sub Worksheet_Change(ByVal Target As Range)

If Target.HasFormula = True Then
Exit Sub
End If
If Target.Cells.Count 1 Then
Exit Sub
End If
Application.EnableEvents = False
Target.Value = UCase(Target.Text)
If Target.Value = "QUARTZ" Or Target.Value = "SODA LIME" Then

Else
MsgBox "Check the Spell"
Target.Select
End If
Application.EnableEvents = True

End Sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
convert text to all upper case without having to retype everythin. MT NATIVE New Users to Excel 2 January 18th 10 08:25 PM
Excel: how to convert text to upper case upon entry? Doug Waters 03/03/08 Excel Discussion (Misc queries) 13 August 6th 08 11:30 PM
Format cell to convert to Upper case widman Excel Discussion (Misc queries) 4 June 3rd 08 08:29 PM
Conver Text to upper case format Harish Excel Programming 1 September 4th 06 09:20 PM
How to convert a column of text to upper and lower case? jewell b Excel Discussion (Misc queries) 1 August 6th 06 09:07 AM


All times are GMT +1. The time now is 03:11 AM.

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

About Us

"It's about Microsoft Excel"