event macro to make entry proper case stopped working

still learning

Well-known Member
Joined
Jan 15, 2010
Messages
784
Office Version
  1. 365
Platform
  1. Windows
Why would this macro stop working?
I can't get F8 to work on it, either
It's used to make an entry proper case in B:B
It is in the sheet modular
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("B:B")) Is Nothing Then Exit Sub
    Application.EnableEvents = False
    If Target.Column Mod 2 = 0 Then
        Target = Application.WorksheetFunction.Proper(Target)
    End If
    Application.EnableEvents = True
End Sub

I edited this to add: I also tried to get it to run by closing out excel and loading it again.
mike
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Opps
I double checked the macro a fourth time and realized that I had moved the data cells to C:C
maybe its time to quite for the day and start again tomorrow...or wait till monday

mike
 
Upvote 0
Try this:

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  Dim rng As Range, c As Range
  Set rng = Intersect(Target, Range("B:B"))
  If Not rng Is Nothing Then
    Application.EnableEvents = False
    For Each c In rng
      c.Value = Application.WorksheetFunction.Proper(c.Value)
    Next
    Application.EnableEvents = True
  End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,012
Messages
6,122,682
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top