+ Reply to Thread
Results 1 to 3 of 3

Ending Macros in a row

Hybrid View

  1. #1
    Registered User
    Join Date
    03-05-2018
    Location
    London
    MS-Off Ver
    2007
    Posts
    2

    Ending Macros in a row

    Hi,

    First time posting! I hope you can all help

    I have created a Macro so when a client clicks on a value form a drop down list it will start tracking the time taken on that one value. (Date and time macro used with a formula on the next column to work out how many days taken)
    Once a client has completed a request, I want the client to be able to click on something so that all the macros stop in that row.

    Is this possible? Would be a break in the current time and date columns?

    Many thanks in advance.

    Farrah x

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,189

    Re: Ending Macros in a row

    can the user select the row, click a button on the Quick Access bar (a macro)
    it runs a macro to post the time

    vStart = cell(activecell.row,2)
    vEnd = Now()
    cell(activecell.row,6) =vEnd 
    cell(activecell.row, 7) = DateDiff("d",vStart,vEnd)     'set days

  3. #3
    Registered User
    Join Date
    03-05-2018
    Location
    London
    MS-Off Ver
    2007
    Posts
    2

    Re: Ending Macros in a row

    Hi Ranman,

    I don't think I have explained myself very well. Apologies. First time!

    What I am looking for is a Break/Stop Macro When Condition/Critria is Met.

    So when the client writes "Yes" in column A...it will break all macros in the row.

    Not too sure if this possible?

    Current Macro code is

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim WorkRng As Range
    Dim Rng As Range
    Dim xoffsetcolumn As Integer
    Set WorkRng = Intersect(Application.ActiveSheet.Range("M:M"), Target)
    Set WorkRng2 = Intersect(Application.ActiveSheet.Range("T:T"), Target)
    xoffsetcolumn = 1
    If Not WorkRng Is Nothing Then
    Application.EnableEvents = False
    For Each Rng In WorkRng
    If Not VBA.IsEmpty(Rng.Value) Then
    Rng.Offset(0, xoffsetcolumn).Value = Now
    Rng.Offset(0, xoffsetcolumn).NumberFormat = "dd-mm-yyyy"
    Else
    Rng.Offset(0, xoffsetcolumn).ClearContents
    End If
    Next
    Application.EnableEvents = True
    End If
    If Not WorkRng2 Is Nothing Then
    Application.EnableEvents = False
    For Each Rng In WorkRng2
    If Not VBA.IsEmpty(Rng.Value) Then
    Rng.Offset(0, xoffsetcolumn).Value = Now
    Rng.Offset(0, xoffsetcolumn).NumberFormat = "dd-mm-yyyy"
    Else
    Rng.Offset(0, xoffsetcolumn).ClearContents
    End If
    Next
    Application.EnableEvents = True
    End If
    End Sub


    Thank you

+ 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. [SOLVED] Macro Ending Early - When Using Range.Value on some macros?
    By bkm2016 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-28-2017, 04:41 PM
  2. [SOLVED] Replace all values with "0" ending to the value with "5" ending
    By mgecelov in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-04-2017, 02:39 PM
  3. Ending Macros
    By lj123 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-12-2008, 01:10 PM
  4. Ending without 'End'
    By pmguerra in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-27-2007, 01:34 PM
  5. how to detect the ending row?
    By phuang1226 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-18-2007, 03:05 PM
  6. Ending zero
    By RAB in forum Excel General
    Replies: 3
    Last Post: 08-25-2005, 02:05 PM
  7. Ending In 5
    By JR in forum Excel General
    Replies: 8
    Last Post: 06-10-2005, 01:05 AM

Tags for this Thread

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