Results 1 to 7 of 7

Auto-correction of a cell after editing

Threaded View

  1. #6
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: Auto-correction of a cell after editing

    Sorry, I missed the requirement for column D in your original post.

    This should do what you need.

    Option Explicit
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim c As Range, regex As Object
    Set regex = CreateObject("vbscript.regexp")
    For Each c In Target
        With c
            If Not .HasFormula Then
                Application.EnableEvents = False
                .Value = UCase(.Value)
                If .Column = 4 And .Value <> "" Then
                    With regex
                        .Global = True
                        .MultiLine = True
                        .Pattern = "[^A-Z0-9]"
                    End With
                        .Value = "'+" & regex.Replace(.Value, "")
                End If
                Application.EnableEvents = True
            End If
        End With
    Next
    End Sub
    Last edited by jason.b75; 07-01-2018 at 06:37 AM. Reason: edited code to allow for multipe cell copy / paste

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Spell Check & Auto Correction For Mixed Language or Another Language
    By zanshin777 in forum Word Formatting & General
    Replies: 1
    Last Post: 06-21-2017, 08:47 PM
  2. Auto correction of cell duplicates
    By damu_prabhakar in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-19-2014, 02:23 AM
  3. [SOLVED] Lower Case to Upper Case but No Auto Correction : Solved by Mod (6StringJazzer)
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-27-2014, 10:44 AM
  4. turning off auto spell correction
    By cprpacific in forum Excel General
    Replies: 3
    Last Post: 07-08-2013, 04:20 PM
  5. Auto correction of entries in a cell matrix
    By damu_prabhakar in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-29-2012, 07:04 AM
  6. [SOLVED] Auto Correction
    By david.salazar in forum Excel General
    Replies: 1
    Last Post: 07-19-2006, 12:30 PM
  7. Auto Editing the Row source.
    By countryfan_nt in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-12-2005, 08:24 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1