+ Reply to Thread
Results 1 to 25 of 25

Auto Update Rows in One Sheet from Another

Hybrid View

tjhart Auto Update Rows in One Sheet... 07-11-2012, 11:26 AM
arlu1201 Re: Auto Update Rows in One... 07-11-2012, 02:41 PM
tjhart Re: Auto Update Rows in One... 07-11-2012, 02:50 PM
tjhart Re: Auto Update Rows in One... 07-12-2012, 01:03 PM
arlu1201 Re: Auto Update Rows in One... 07-13-2012, 11:34 AM
tjhart Re: Auto Update Rows in One... 07-13-2012, 12:10 PM
tjhart Re: Auto Update Rows in One... 07-13-2012, 01:22 PM
arlu1201 Re: Auto Update Rows in One... 07-14-2012, 02:17 PM
tjhart Re: Auto Update Rows in One... 07-16-2012, 01:36 PM
arlu1201 Re: Auto Update Rows in One... 07-16-2012, 02:38 PM
tjhart Re: Auto Update Rows in One... 07-23-2012, 09:53 AM
arlu1201 Re: Auto Update Rows in One... 07-23-2012, 10:40 AM
tjhart Re: Auto Update Rows in One... 07-24-2012, 03:58 PM
arlu1201 Re: Auto Update Rows in One... 07-25-2012, 08:44 AM
tjhart Re: Auto Update Rows in One... 07-25-2012, 10:19 AM
tjhart Re: Auto Update Rows in One... 07-25-2012, 02:28 PM
tjhart Re: Auto Update Rows in One... 07-27-2012, 12:41 PM
arlu1201 Re: Auto Update Rows in One... 07-25-2012, 11:10 AM
arlu1201 Re: Auto Update Rows in One... 07-30-2012, 04:41 AM
tjhart Re: Auto Update Rows in One... 07-30-2012, 10:05 AM
arlu1201 Re: Auto Update Rows in One... 08-08-2012, 06:41 AM
tjhart Re: Auto Update Rows in One... 08-08-2012, 02:40 PM
arlu1201 Re: Auto Update Rows in One... 08-08-2012, 02:41 PM
tjhart Re: Auto Update Rows in One... 08-08-2012, 02:46 PM
tjhart Re: Auto Update Rows in One... 08-14-2012, 01:08 PM
  1. #1
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Auto Update Rows in One Sheet from Another

    Try this code
    Option Explicit
    
    Sub update_status()
    Dim lrow As Long, i As Long, a As Long
    
    With Worksheets("Status")
        lrow = .Range("B" & .Rows.Count).End(xlUp).Row
        For i = 4 To lrow
            If .Range("B" & i).Value <> "Risk" Then
                .Range("B" & i).Value = ""
            End If
        Next i
    End With
    
    a = 4
    With Worksheets("Issue Log")
        lrow = .Range("C" & .Rows.Count).End(xlUp).Row
        For i = 3 To lrow
            If .Range("G" & i).Value = "Open" And .Range("H" & i).Value = "Critical" Then
                If Worksheets("Status").Range("B" & a + 2).Value = "Risk" Then
                    Worksheets("Status").Rows(a).Insert
                End If
                Worksheets("Status").Range("B" & a).Value = .Range("D" & i).Value
                a = a + 1
            End If
        Next i
    End With
    
    With Worksheets("Status")
        lrow = .Range("B" & .Rows.Count).End(xlUp).Row
        For i = 4 To lrow
            If .Range("B" & i).Value = "Risk" Then
                a = i + 1
                Exit For
            End If
        Next i
    End With
    
    With Worksheets("Risk Tracker")
        lrow = .Range("C" & .Rows.Count).End(xlUp).Row
        For i = 3 To lrow
            If .Range("G" & i).Value = "Critical" Then
                If Worksheets("Status").Range("B" & a + 1 & ":M" & a + 1).MergeCells = False Then
                    Worksheets("Status").Rows(a).Insert
                End If
                Worksheets("Status").Range("B" & a).Value = .Range("D" & i).Value
                a = a + 1
            End If
        Next i
    End With
    
    End Sub
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    Choose Insert | Module
    Where the cursor is flashing, choose Edit | Paste

    To run the Excel VBA code:
    Choose View | Macros
    Select a macro in the list, and click the Run button

    Couple of observations

    1. Make all the updates to the Issue Log and Risk Tracker and then run the macro.
    2. The conditions for the Issue Log are column G=Open and Column H=Critical.
    3. The conditions for the Risk Tracker are column G=Critical

    Let me know if anything needs to be changed.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  2. #2
    Registered User
    Join Date
    06-28-2012
    Location
    New York, New York
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Auto Update Rows in One Sheet from Another

    This was a great first go at it! The issue update looks to be running great, but there were a few issues with the risks update ... See below:

    1) I forgot to add the Status column to the risk tracker sheet. If that could be added to the criteria that would be great.
    2) If you run the macro multiple times the updates to risk tracker on the status page will continuously add empty rows. After about the fifth run of the macro it acts funky and begins to insert rows formatted like the header. If you hit the macro enabled button 5 times you will see what I mean.

    I've attached a copy of the workbook with the macro created for your reference. Thank you so much for you help on this. It's so close!

    TJH
    Attached Files Attached Files
    Last edited by tjhart; 07-13-2012 at 02:51 PM.

  3. #3
    Registered User
    Join Date
    06-28-2012
    Location
    New York, New York
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Auto Update Rows in One Sheet from Another

    One last question:

    In the future, if I want to add another section (Action) to status pulling from a new worksheet (Action Items) based off of the same criteria as the other sheet how do I need to go about adding that to the macro?

    Example file attached

    Thanks again,
    TJH
    Attached Files Attached Files
    Last edited by tjhart; 07-13-2012 at 02:52 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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