• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA Code not working

Shazz

Member
Hi All,

I am using the below VBA Code to force a range of cells to upper case, it works in all but one of my worksheets, anyone have any ideas.

I have also attached an example of the sheet.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
''''''''''''''''''''''''''''''''''''''''''''
'Forces text to UPPER case for the range M6:S68
''''''''''''''''''''''''''''''''''''''''''''
If Target.Cells.Count > 1 Or Target.HasFormula Then Exit Sub
    On Error Resume Next
    If Not Intersect(Target, Range("M6:S68")) Is Nothing Then
        Application.EnableEvents = False
        Target = UCase(Target)
        Application.EnableEvents = True
    End If
    On Error GoTo 0

End Sub
 

Attachments

  • Example.xls
    54 KB · Views: 4
Hi,

Pls let us know where [Range] code is not working as same will only work in Range("M6:S68") as configured in code.
 
Hi ,

I have no idea why the example workbook has been uploaded ; is it because the macro does not work in the file's lone worksheet ?

If you want a problem to be debugged , upload a file with the problem ; uploading a file which does not have a problem is not going to help.

Narayan
 
Back
Top