+ Reply to Thread
Results 1 to 6 of 6

Change On_Open macro to a cell change in a range of cells

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-09-2015
    Location
    Jamestown, TN
    MS-Off Ver
    2010
    Posts
    111

    Change On_Open macro to a cell change in a range of cells

    Hi all,
    Is there a way to get the following code to fire once a cell changes in a range of M10:M (if any cell changes from M10 down to "end of project" ?

    Private Sub Workbook_Open()
    Dim i As Long
                    With Sheets("Sheet1")
    i = 2:      Do Until .Range("B" & i) = "End of Project"
    If .Range("C" & i) < 1 And .Range("D" & i) <> "" Then _
            .Range("E" & i) = Range("A1")
                i = i + 1:  Loop
                    End With
     End Sub
    Thanks everyone!
    Dave

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: Change On_Open macro to a cell change in a range of cells

    in thisworkbook code:
    Private Sub Workbook_Open()
    call looping_till_EOP
    End Sub
    in Sheet1 code
    Private Sub Worksheet_Change(ByVal Target As Range)
    if not intersect(target,range("M10:M"&rows.count)) is nothing then
    call looping_till_EOP
    end if
    End Sub
    in normal module
    sub looping_till_EOP()
    Dim i As Long
                    With Sheets("Sheet1")
    i = 2:      Do Until .Range("B" & i) = "End of Project"
    If .Range("C" & i) < 1 And .Range("D" & i) <> "" Then _
            .Range("E" & i) = Range("A1")
                i = i + 1:  Loop
                    End With
    end sub
    Best Regards,

    Kaper

  3. #3
    Forum Contributor
    Join Date
    04-09-2015
    Location
    Jamestown, TN
    MS-Off Ver
    2010
    Posts
    111

    Re: Change On_Open macro to a cell change in a range of cells

    Thank you Kaper!
    Works just wonderful~ I will call this solved
    Right out of the box even
    Dave

  4. #4
    Forum Contributor
    Join Date
    04-09-2015
    Location
    Jamestown, TN
    MS-Off Ver
    2010
    Posts
    111

    Re: Change On_Open macro to a cell change in a range of cells

    Hi all,
    This worked fine in a sample but now that I am putting it into my actual working schedule I cant get it to work? The only difference is basically I have cells with calculations/formulas in them. Is there a way to make this so it works and skips the cells with formulas in "M and N"
    Code is below, and I attached a sheet!

    This code when wb_open auto adds today's date in "N" if a date is in "M". When I put a date in "M" it auto puts today's date (F6) into "N". And adds today, each time sheet is opened or changed till 100% complete in "G"



    This workbook Code:

    Private Sub Workbook_Open()
    
    call looping_till_EOP
    
    End Sub


    Sheet 1 Code:

    Private Sub Worksheet_Change(ByVal Target As Range)
    
    if not intersect(target,range("M12:M"&rows.count)) is nothing then
    
    call looping_till_EOP
    
    end if
    
    End Sub


    In Normal Module:

    sub looping_till_EOP()
    
    Dim i As Long
    
                    With Sheets("Sheet1")
    
    i = 12:      Do Until .Range("B" & i) = "End of Project"
    
    If .Range("G" & i) < 1 And .Range("M" & i) <> "" Then _
    
            .Range("N" & i) = Range("F6")
    
                i = i + 1:  Loop
    
                    End With
    
    end sub
    Attached Files Attached Files
    Last edited by davidpierce; 05-22-2015 at 04:04 AM.

  5. #5
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: Change On_Open macro to a cell change in a range of cells

    Check if these two changes:
    Do Until ucase(.Range("B" & i)) = "END OF PROJECT"
    and
    If .Range("G" & i) < 1 And .Range("M" & i).value <> "" and _
      not(.Range("M" & i).hasformula) and not(.Range("N" & i).hasformula) Then _
            .Range("N" & i) = Range("F6")
    help

  6. #6
    Forum Contributor
    Join Date
    04-09-2015
    Location
    Jamestown, TN
    MS-Off Ver
    2010
    Posts
    111

    Re: Change On_Open macro to a cell change in a range of cells

    That seamed to work just fine. Thank you again! I will test it tomorrow when the date changes and see if the 100% stops too!
    Thanks so much
    Dave

+ 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. If range value change, active cell equal date and time of change.
    By kmakjop in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-31-2015, 02:43 PM
  2. [SOLVED] Run a macro when a change occurs in a range of cells (two macros and two cell ranges)
    By zanguard80 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-03-2014, 07:11 AM
  3. Macro to change all borders in a range of cells
    By DJFudd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-13-2013, 01:00 AM
  4. Change range of cells within VBA macro and copy and paste to fixed cell range
    By Mannyny in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-20-2012, 11:51 AM
  5. Replies: 5
    Last Post: 03-20-2012, 09:12 PM

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