Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Forced Capitals

I have this formula for forcing capitals to be entered into column C:-

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
If Target.Column = 3 Then
For Each cell In Target.Cells
With cell
If Not .HasFormula And Not IsNumeric(.Value) Then
Application.EnableEvents = False
..Value = UCase(.Value)
Application.EnableEvents = True
End If
End With
Next cell
End If
End Sub

Could anybody help me configure it so I can do this for Column D and E
as well? (I.E. Column's 4 and 5)


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Forced Capitals

Hi Ian!

Try:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
If Target.Column = 3 And Target.Column <= 5 Then
For Each cell In Target.Cells
With cell
If Not .HasFormula And Not IsNumeric(.Value) Then
Application.EnableEvents = False
Target.Value = UCase(.Value)
Application.EnableEvents = True
End If
End With
Next cell
End If
End Sub

--
Regards
Norman Harker MVP (Excel)
Sydney, Australia

Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Forced Capitals

Ian,

Replace your statement :
If Target.Column = 3 Then
with :

If Target.Column 3 And Target.Column < 6 Then

Your routine as it is now doesn't replace the input with the capital.
To accomplish you should also replace :
Value = UCase(.Value)
with :
..Value = UCase(.Value)
( NB the . before the first Value)

--
Regards,
Auk Ales

* Please reply to this newsgroup only *
* I will not react on unsolicited e-mails *

"ianripping " wrote in message
...
I have this formula for forcing capitals to be entered into column C:-

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
If Target.Column = 3 Then
For Each cell In Target.Cells
With cell
If Not .HasFormula And Not IsNumeric(.Value) Then
Application.EnableEvents = False
Value = UCase(.Value)
Application.EnableEvents = True
End If
End With
Next cell
End If
End Sub

Could anybody help me configure it so I can do this for Column D and E
as well? (I.E. Column's 4 and 5)


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Forced Capitals

Sorry 3 should be 2

--
Regards,
Auk Ales

* Please reply to this newsgroup only *
* I will not react on unsolicited e-mails *

"A.W.J. Ales" wrote in message
...
Ian,

Replace your statement :
If Target.Column = 3 Then
with :

If Target.Column 3 And Target.Column < 6 Then

Your routine as it is now doesn't replace the input with the capital.
To accomplish you should also replace :
Value = UCase(.Value)
with :
.Value = UCase(.Value)
( NB the . before the first Value)

--
Regards,
Auk Ales

* Please reply to this newsgroup only *
* I will not react on unsolicited e-mails *

"ianripping " wrote in message
...
I have this formula for forcing capitals to be entered into column C:-

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
If Target.Column = 3 Then
For Each cell In Target.Cells
With cell
If Not .HasFormula And Not IsNumeric(.Value) Then
Application.EnableEvents = False
Value = UCase(.Value)
Application.EnableEvents = True
End If
End With
Next cell
End If
End Sub

Could anybody help me configure it so I can do this for Column D and E
as well? (I.E. Column's 4 and 5)


---
Message posted from http://www.ExcelForum.com/





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
Capitals rexmann Excel Discussion (Misc queries) 3 February 29th 08 11:15 AM
Cosmetics Capitals Arlene Excel Worksheet Functions 4 July 13th 07 05:22 PM
All Capitals lostinformulas Excel Worksheet Functions 6 June 14th 06 08:07 PM
Text formatted as All Capitals? Joey New Users to Excel 6 June 2nd 05 12:23 AM
Text All Capitals Joey New Users to Excel 3 May 31st 05 11:54 PM


All times are GMT +1. The time now is 09:21 PM.

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"