+ Reply to Thread
Results 1 to 16 of 16

if cell is=z copy entire row to another sheet

  1. #1
    Registered User
    Join Date
    05-13-2010
    Location
    Ireland
    MS-Off Ver
    Excel 2007
    Posts
    90

    if cell is=z copy entire row to another sheet

    What i am trying to do is to copy the entire row from sheet1 to sheet2 if value on column X is "suspicious". For example if X4,X8,X12 have the word "suspicious" i want to copy rows 4,8,11 on sheet2 one below the other.
    One detail: i want this list to start from the 4th line on sheet2(not from the 1st)
    I tried to searched the forum but i couldn't find a code for this.
    I attached a test workbook to help

    Thanks
    Attached Files Attached Files
    Last edited by tsioumiou; 02-14-2011 at 07:40 PM.

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

    Re: if cell is=z copy entire row to another sheet

    see attachment, there are two codes as I did not clearly understand what should be the result, run "test" and "test1"
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    05-13-2010
    Location
    Ireland
    MS-Off Ver
    Excel 2007
    Posts
    90

    Re: if cell is=z copy entire row to another sheet

    Quote Originally Posted by watersev View Post
    see attachment, there are two codes as I did not clearly understand what should be the result, run "test" and "test1"
    First of all thanks for the reply watersev.
    On the workbook that you send me the code works and looks great. Unfortunatelly when i try to add it on my workbook it gives me an error "no cells were found"

    I attached you the workbook.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    05-13-2010
    Location
    Ireland
    MS-Off Ver
    Excel 2007
    Posts
    90

    Re: if cell is=z copy entire row to another sheet

    Quote Originally Posted by tsioumiou View Post
    First of all thanks for the reply watersev.
    On the workbook that you send me the code works and looks great. Unfortunatelly when i try to add it on my workbook it gives me an error "no cells were found"

    I attached you the workbook.
    Better example of how i get the error (attached workbook aaaa.xls)

    Basically the first code (test) is exactly what i need. It copies the right row but on X column on sheet2 its doesnt have the word "suspicious".It has #value for some reason


    Thanks
    Attached Files Attached Files
    Last edited by tsioumiou; 02-09-2011 at 02:29 PM.

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

    Re: if cell is=z copy entire row to another sheet

    see attachment, run macro "testnew". I've changed the way the code works. It makes all those calculations "behind the scenes" but shows result in respective row of sheet 2. That's why I moved them after column "X" for you to verify result. So you do not need to make those calculations on the sheet anymore. Hope you don't mind.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    05-13-2010
    Location
    Ireland
    MS-Off Ver
    Excel 2007
    Posts
    90

    Re: if cell is=z copy entire row to another sheet

    That is exactly what i want!!
    You are awesome

    One small thing, after i run the report, on sheet2 on column H and K i see the dates. Is it possible to see the dates and the time as well?
    Or if not, only the time? I know its a bit complicated because all the other cells are merged but i really hope you can help.

    Thanks a million

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

    Re: if cell is=z copy entire row to another sheet

    see attachment, if you are happy with the outcome, please mark the thread as solved
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    05-13-2010
    Location
    Ireland
    MS-Off Ver
    Excel 2007
    Posts
    90

    Re: if cell is=z copy entire row to another sheet

    I am very happy. You just saved me lots of work .

    Thanks

  9. #9
    Registered User
    Join Date
    05-13-2010
    Location
    Ireland
    MS-Off Ver
    Excel 2007
    Posts
    90

    Re: if cell is=z copy entire row to another sheet

    I am really sorry for giving you a hard time now,
    but i am getting "Run-time error '9' Subscript out of range"
    I only added one 1 line at the bottom of the workbook as you can see (row 62 in that case) and it gives me that error. This line is very important for me because it is there when i copy this whole report, it cannot be deleted. is there a way to avoid this error?

    Another thing it also gives me an error when it wont find any lines to copy(this is not so important though)

    Attached the workbook

    Thanks
    Attached Files Attached Files
    Last edited by tsioumiou; 02-10-2011 at 06:17 PM.

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

    Re: if cell is=z copy entire row to another sheet

    please check attachment
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    05-13-2010
    Location
    Ireland
    MS-Off Ver
    Excel 2007
    Posts
    90

    Re: if cell is=z copy entire row to another sheet

    Thanks for the reply.
    I will check on Monday and get back to you

  12. #12
    Registered User
    Join Date
    05-13-2010
    Location
    Ireland
    MS-Off Ver
    Excel 2007
    Posts
    90

    Re: if cell is=z copy entire row to another sheet

    Seems to be working fine now.

    One question : The columns on sheet1 with the calculations (Y,Z,AA,AB) are useless now since you make the calculation with VBA. Which means i can delete them right?

    Also it shows me an error on this line when it doesnt find any results (not so important as i said, only if u find some free time)
    Please Login or Register  to view this content.
    Everything looks so good.
    Thanks a lot man
    Last edited by tsioumiou; 02-14-2011 at 12:02 AM.

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

    Re: if cell is=z copy entire row to another sheet

    hi, tsioumiou, yes those columns can be deleted, the code does not work with their data. I've made some changes to the code. If no suspicious transactions found it will message you about it and shut down quietly. Use this code as a final version.

    PS. If we are done and you are happy with the outcome please mark the thread as solved.
    Attached Files Attached Files

  14. #14
    Registered User
    Join Date
    05-13-2010
    Location
    Ireland
    MS-Off Ver
    Excel 2007
    Posts
    90

    Re: if cell is=z copy entire row to another sheet

    Perfect.
    Thanks for your time, learned a lot from this

    SOLVED

  15. #15
    Registered User
    Join Date
    12-24-2011
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: if cell is=z copy entire row to another sheet

    sad.xlsdo something like this as same but i need some extra i have attached the file and in file i clear what i want

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

    Re: if cell is=z copy entire row to another sheet

    hi there, you need to start a new thread in order to follow the Forum Rules. If you consider that this thread relates to your new thread you may give a link to it.

+ 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