+ Reply to Thread
Results 1 to 4 of 4

How to get macro to run when data is entered into a specific column

Hybrid View

  1. #1
    Registered User
    Join Date
    01-06-2015
    Location
    York, PA
    MS-Off Ver
    2010
    Posts
    2

    How to get macro to run when data is entered into a specific column

    This is the code that I want to run automatically whenever someone enters data. Any help would be appreciated. Thanks.

    Sub add_apostrophe()
    'will add an ' in front of whats in the used range in column A
    Set Rng = Intersect(Range("A:A"), ActiveSheet.UsedRange)
    For Each c In Rng
    c.Value = "'" & c
    Next
    End Sub

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: How to get macro to run when data is entered into a specific column

    You need to use an Event procedure, specifically on the worksheet this applies to.
    Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Target.Column = 1 Then
    Target.Value = "'" & Target.Value
    End If
    End Sub
    If you are trying to place apostrophes in front of formulas, swap out Value for Formula.
    Last edited by daffodil11; 01-07-2015 at 01:39 PM. Reason: Oops.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Registered User
    Join Date
    01-06-2015
    Location
    York, PA
    MS-Off Ver
    2010
    Posts
    2

    Re: How to get macro to run when data is entered into a specific column

    Thanks this worked for me. YEA

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: How to get macro to run when data is entered into a specific column

    Hurray for happy times! And the Shoe House by Hallam!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Help: Auto applying a formula to new data when entered in to a specific column.
    By LuckoftheLefty in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-26-2014, 03:28 AM
  2. [SOLVED] running a macro when specific text is entered into a specific cell
    By deek in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-02-2014, 10:05 AM
  3. Replies: 3
    Last Post: 02-05-2013, 12:57 PM
  4. Move row of data to another sheet once a date is entered in a specific column
    By stankanie in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-27-2012, 09:21 AM
  5. macro - Save in .xls format/to specific location/name from entered data/show message
    By mimichan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-18-2012, 10:38 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