+ Reply to Thread
Results 1 to 6 of 6

Update row based on cell input in another sheet

  1. #1
    Registered User
    Join Date
    11-02-2011
    Location
    Abu Dhabi, UAE
    MS-Off Ver
    Excel 2007
    Posts
    9

    Update row based on cell input in another sheet

    Hi all,

    I've to sheets [Sheet1 & Sheet3] in the first sheet I used a macro to copy rows to sheet3 based on cell input from dropdown list. The code works, so that whenever they select [High] rating, that whole row will be copied to the other sheer.

    The only problem I have is that whenever I go back and change rating from High to Low, Medium or delete the rating, that change doesn’t reflect on Sheet3. I need whenever the change the rating the macro should go back and delete the equivalent row from sheet3 that was copied there previously.

    This is the macro I used:

    Private Sub Worksheet_Change(ByVal Target As Range)
    ' Code goes in the Worksheet specific module
    Dim rng As Range
    ' Set Target Range, i.e. Range("A1, B2, C3"), or Range("A1:B3")
    Set rng = Target.Parent.Range("D:D")
    ' Only look at single cell changes
    If Target.Count > 1 Then Exit Sub
    ' Only look at that range
    If Intersect(Target, rng) Is Nothing Then Exit Sub
    ' Action if Condition(s) are met (do your thing here...)
    If LCase(Target.Value) = "high" Then
    With Target.EntireRow
    .Copy Sheets("Sheet3").Cells(Rows.Count, "D").End(xlUp).Offset(1, -3)
    End With
    End If
    End Sub
    I hope I made it clear. attached is an example of the workbook.
    example.xlsm
    Last edited by Kazumi; 11-13-2011 at 03:27 AM.

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Update row based on cell input in another sheet

    please put your code in code tags rather than quote tabs and I'll post the solution

  3. #3
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Update row based on cell input in another sheet

    hi, Kazumi, will that help? Please check attachment
    Attached Files Attached Files

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Update row based on cell input in another sheet

    That's nice watersev, I think I'd prefer this though aesthetically:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-02-2011
    Location
    Abu Dhabi, UAE
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Update row based on cell input in another sheet

    Quote Originally Posted by watersev View Post
    hi, Kazumi, will that help? Please check attachment
    Thank you this work perfectly

  6. #6
    Registered User
    Join Date
    11-02-2011
    Location
    Abu Dhabi, UAE
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Update row based on cell input in another sheet

    Quote Originally Posted by Kyle123 View Post
    That's nice watersev, I think I'd prefer this though aesthetically:
    Please Login or Register  to view this content.
    Appreciate your help, it works perfectly.

+ 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