+ Reply to Thread
Results 1 to 4 of 4

On Cell change, execute macro

  1. #1
    Registered User
    Join Date
    12-19-2007
    Posts
    3

    Cool On Cell change, execute macro

    Hi,

    I'm working on a spreadsheet that will minimise the effort for users that update it. For example they are required to enter a value in cells F7:F560 and on this I want to have my macro update the cell Offset(0, 4) with today's date. see below for example of my code. The problem I'm having is that this seems to run where ever i click in the worksheet and takes about 5 - 6 seconds to run.

    Any ideas on how I could make this a bit more efficient to run.

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim Thing As Range
    Set act = Range("F7:F535")
    For Each Thing In act
    If Thing.Value = "" Then

    Thing.Offset(0, 4) = ""

    ElseIf Thing.Value <> "" And Thing.Offset(0, 4) = "" Then

    Thing.Offset(0, 4) = Now

    End If
    Next

    End Sub

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    des_wes

    Welcome to exceforum

    Please read forum rules & wrap your VBA code

    A thread with the rules is available at the top of each forum or see links below

    If you do not understand the VBA code wrap instructions have a look at my last reply in this thread
    http://www.excelforum.com/showthread.php?t=583950
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Registered User
    Join Date
    12-19-2007
    Posts
    3
    so if i just put
    Please Login or Register  to view this content.
    before and after the piece that will be fine?

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Yeap so that the VBA/macro code appears like that you have the ---- in your reply

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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