Consulting

Results 1 to 7 of 7

Thread: Solved: Cut and paste a row to another sheet depending on cell value

  1. #1
    VBAX Regular
    Joined
    Mar 2006
    Posts
    10
    Location

    Solved: Cut and paste a row to another sheet depending on cell value

    Hello
    I am new to this forum and to VBA.

    I'm not sure if what I'm after can be done - I've got one worksheet (called "open") where each row is an idea. One of the columns shows the status of the idea, either open or closed.

    Is it possible that when the status is closed, the row can be cut and pasted to an existing worksheet ie named "closed"? And also can the row be deleted so not to leave a gap on the "open" sheet?

    Any help would be much appreciated.

    Thanks
    Grace

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Grace,
    Welcome to VBAX.
    Here's some code and an example. It assumes that Open/Closed is listed in column B
    Regards
    MD

    [vba]
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Cells.Count > 1 Then Exit Sub
    Application.EnableEvents = False
    If Target.Column = 2 And UCase(Target) = "CLOSED" Then
    Target.EntireRow.Copy Sheets("Closed").Cells(Rows.Count, 1).End(xlUp).Offset(1)
    Target.EntireRow.Delete
    End If
    Application.EnableEvents = True
    End Sub

    [/vba]
    Last edited by mdmackillop; 03-06-2006 at 04:45 PM. Reason: Typo corrected in code and sample
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Grace,
    Previous code and sample amended to correct typos.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  4. #4
    VBAX Regular
    Joined
    Mar 2006
    Posts
    10
    Location
    That is brilliant, thank you for your help

  5. #5
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    HTH
    MD
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  6. #6
    VBAX Regular
    Joined
    Mar 2006
    Posts
    10
    Location
    Bumping from the depths to ask if attachments are removed after a certain amount of time?

    After a break from doing this type of work, I am back to

    I thought I would be able to figure out a similar code from the example but I think I need the attachment to make sense of it...

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    They do seem to be. I have tried looking at previous posts only to find the attachment dropped off. Not sure what the threshold is though
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •