+ Reply to Thread
Results 1 to 4 of 4

formula to copy cells to new worksheet

  1. #1
    Registered User
    Join Date
    03-02-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    2

    formula to copy cells to new worksheet

    hello,

    I have a situation where i need to copy all line items with the word "approved" in a certain column to a new worksheet so that only approved items will be at the new sheet. can you please advise on how to get this done?

    thanks in advance

  2. #2
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: formula to copy cells to new worksheet

    Hi..
    Can u give sample data?

  3. #3
    Registered User
    Join Date
    03-02-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: formula to copy cells to new worksheet

    Hi, in the two columns below, pretend that this is the master list, and i need every line item where column B is "approved" to copy itself to a new worksheet, so the new worksheet will only have the approved line items. hope this explains the situation.

    thanks

    black approved
    white denied
    blue approved
    yellow denied
    brown approved
    red approved

  4. #4
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: formula to copy cells to new worksheet

    Hi...
    Try this code. Please note u may have to change the worksheet name.

    Sub COPYINTOANOTHERSHEET()
    Dim rcnt As Long, cnt As Long, i As Long

    Sheets("Sheet9").Select
    rcnt = Sheets("Sheet9").Range("A" & Rows.Count).End(xlUp).Row
    cnt = Sheets("Sheet10").Range("A" & Rows.Count).End(xlUp).Row

    For i = 1 To rcnt
    If Sheets("Sheet9").Range("B" & i).Value = "approved" Then
    Rows(i & ":" & i).Copy (Sheets("Sheet10").Range("A" & cnt))
    cnt = cnt + 1
    End If
    Next
    End Sub

    Regards...

+ 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