Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I make specific columns Proper or Caps?


Hi -

I copied the following code from this forum to make certain columns
caps and another proper:


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Cells.Count 1 Then Exit Sub
On Error GoTo ErrHandler
Application.EnableEvents = False
If Target.Column <= 5 Then
Target.Value = UCase(Target.Value)
Else
Target.Value = Application.Proper(Target.Value)
End If
ErrHandler:
Application.EnableEvents = True
End Sub

My question is, how do I make a specific column proper? If I want
column 6 only proper, how do i do that?

thanks


--
rmm30


------------------------------------------------------------------------
rmm30's Profile: http://www.excelforum.com/member.php...fo&userid=8358
View this thread: http://www.excelforum.com/showthread...hreadid=386119

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 221
Default How do I make specific columns Proper or Caps?

Change the line to say this:
If Target.Column = 6 Then

*******************
~Anne Troy

www.OfficeArticles.com
www.MyExpertsOnline.com


"rmm30" wrote in message
...

Hi -

I copied the following code from this forum to make certain columns
caps and another proper:


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Cells.Count 1 Then Exit Sub
On Error GoTo ErrHandler
Application.EnableEvents = False
If Target.Column <= 5 Then
Target.Value = UCase(Target.Value)
Else
Target.Value = Application.Proper(Target.Value)
End If
ErrHandler:
Application.EnableEvents = True
End Sub

My question is, how do I make a specific column proper? If I want
column 6 only proper, how do i do that?

thanks


--
rmm30


------------------------------------------------------------------------
rmm30's Profile:

http://www.excelforum.com/member.php...fo&userid=8358
View this thread: http://www.excelforum.com/showthread...hreadid=386119



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 691
Default How do I make specific columns Proper or Caps?

I'll throw in an Elseif statement such as for a zip state code
if you don't want it then remove it.

If target.Column = 6 then
Target.Value = Application.Proper(Target.Value)
ElseIF Target.Column 9 Then
Target.Value = UCase(Target.Value)
Else
'code here ... if you still want something done for all other cases
End If

More information on uppercase, propercase, sentence case see
http://www.mvps.org/dmcritchie/excel/proper.htm

You should probably code for proper case exceptions yourself
especially if working with people's names based on what you
find in your own data.

You will have to learn how to code for IF, then, else as this is basic to
use of VBA.

For more information on IF, Then, Else see HELP from within the VBE
search on: if then else
topic: If...Then...Else Statement

variations:
If target.Column = 6
If target.Column = 6 or 8
If target.column <= 6
If target.column = 9

Which is considerably different that a Worksheet function, see HELP from within Excel
Index (not available in Excel 2003): IF_Worksheet_Function
or search on: IF function
topic: IF Worksheet Function

IF THEN in worksheet functions and in VBA
http://www.mvps.org/dmcritchie/excel/ifthen.htm

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"rmm30" wrote ...
I copied the following code from this forum to make certain columns
caps and another proper: [clipped]



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
Changing all caps to proper Jo4321 Excel Discussion (Misc queries) 7 March 3rd 09 04:34 PM
proper formula - how to make the state be CAPS kmjmail Excel Discussion (Misc queries) 3 January 6th 09 11:49 PM
How do I change the case from all caps to proper for names I have in columns E, F, G? duugg Excel Discussion (Misc queries) 22 April 26th 06 01:25 PM
Converting All Caps to Proper casing jermsalerms Excel Worksheet Functions 2 January 6th 06 01:03 AM
How do I make some columns all caps and others proper? rmm30 Excel Discussion (Misc queries) 2 June 13th 05 07:35 PM


All times are GMT +1. The time now is 04:35 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"