+ Reply to Thread
Results 1 to 12 of 12

If cell = x (mixed with other character in a cell) then copy paste row

  1. #1
    Registered User
    Join Date
    06-24-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    7

    Unhappy If cell = x (mixed with other character in a cell) then copy paste row

    Hello,

    I have this code working on my sheet, my problem is it do not work when cell contains a mixed of characters but i still need to copy and paste the row if it contains the specified text even if its mixed of characters inside a cell.

    here is my code:

    Please Login or Register  to view this content.
    could any one help me please?
    Last edited by jeffreybrown; 06-25-2012 at 10:06 AM. Reason: Added code tags for new user. Please add them next time.

  2. #2
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: If cell = x (mixed with other character in a cell) then copy paste row

    Maybe, you need something like:

    If InStr(1, Cells(x, 5), "GW") > 0 Then

  3. #3
    Registered User
    Join Date
    06-24-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: If cell = x (mixed with other character in a cell) then copy paste row

    Thanks for the reply!

    i am not that familiar with vba i only understands little of it. what i did with the code you gave is replaced the, existing *If Cells(x, 5) = "GW" Then* but nothing happens. Please let me know if i am doing it in a wrong way? and if there's any other way we could add something like a * (asterisk) to the existing code to search for the specified "GW" even it has other text inside a cell like "*GW*".

  4. #4
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: If cell = x (mixed with other character in a cell) then copy paste row

    Hi Makko, try it
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-24-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: If cell = x (mixed with other character in a cell) then copy paste row

    Hi Mr. nilem,

    I tried working on your code and honestly i understand only few on your code hehe ... i guessed i really need to try harder to learn
    VBA.

    Your code is working perfect and i like to use it and replace the old code i have... the only problem i have now is the sheets now are
    modified and has a Column Tab and Header which should be bypassed by the search and paste. Now my Newbie-ness really gone to the highest level

    I've modified your code a little to get it working on a search row that was on the 5th column (now on the 7th) but bcoz of the
    Column Tab and Header, the pasting on the other sheet is not in the right position anymore and the code is only pasting 5 columned data.

    I attached a file for reference of the problem. Your help will be very much appreciated please... thanks in advance to all here!!!
    Attached Files Attached Files

  6. #6
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: If cell = x (mixed with other character in a cell) then copy paste row

    If the "Action By:" column has a value "GW / TH", the entire string must be copied on sheets of "Engineering & INTF (GW)" and "Process (TH)". Right?

  7. #7
    Registered User
    Join Date
    06-24-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: If cell = x (mixed with other character in a cell) then copy paste row

    Thanks for the reply Mr. Nilem, intentional reply to your post but posted it in the reply to thread..

  8. #8
    Registered User
    Join Date
    06-24-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: If cell = x (mixed with other character in a cell) then copy paste row

    Mr. Nilem,

    Yes exactly!

    Note: Please disregard the #7th reply to thread before this...

  9. #9
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: If cell = x (mixed with other character in a cell) then copy paste row

    I have recorded numbers 1...10 in row 9 on each sheet and carried the code in Module1.
    And put my green button.

    Probably need to delete those records from a sheet of "ALL Incoming", which had been transferred to other sheets?
    Please Login or Register  to view this content.
    edited: delete line With Worksheets("Construct (PG)")
    Attached Files Attached Files
    Last edited by nilem; 06-26-2012 at 03:14 AM.

  10. #10
    Registered User
    Join Date
    06-24-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: If cell = x (mixed with other character in a cell) then copy paste row

    OMG! you are a star! thank you very much! i am very much surprised for this short period of time the issues are solved... this is what i really needed. You did everything for me.

    i only have one more question what is "(946, 1)" means?

    please continue on helping other people GODSPEED to YOU!!!

  11. #11
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: If cell = x (mixed with other character in a cell) then copy paste row

    B946 cell contains "*" and the expression
    Please Login or Register  to view this content.
    will return to us the last filled cell, ie B946
    So we use the Cells(946, 2).End(xlUp), to obtain the desired cell, ie B9.

    And the A946 cell is empty, and the expression
    Please Login or Register  to view this content.
    will return to us the last cell, ie A9

  12. #12
    Registered User
    Join Date
    06-24-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: If cell = x (mixed with other character in a cell) then copy paste row

    Thanks once again to hope i could be just good as you have a blessed life to you and your family!!!

+ 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