+ Reply to Thread
Results 1 to 9 of 9

vba find text , move entire cell to the same row column C

  1. #1
    Registered User
    Join Date
    11-29-2012
    Location
    Vilnius
    MS-Off Ver
    Excel 2010
    Posts
    8

    vba find text , move entire cell to the same row column C

    I have macros, which search word "abc" in column D, the move this cell to column C:

    Please Login or Register  to view this content.
    I need the same only search range must be all active columns starting from D , e.g. D1:W5000. All found cells should move to column C.
    Last edited by sausis; 10-06-2015 at 10:30 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2504 Win 11
    Posts
    24,691

    Re: vba find text , move entire cell to the same row column C

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Valued Forum Contributor
    Join Date
    08-07-2014
    Location
    Quito, Ecuador
    MS-Off Ver
    Excel 2016 & 365, Windows 10
    Posts
    511

    Re: vba find text , move entire cell to the same row column C

    Hi Sausis,
    what happens if you have more than one cell in the same row starting by "abc"

    Captura.JPG

  4. #4
    Registered User
    Join Date
    11-29-2012
    Location
    Vilnius
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: vba find text , move entire cell to the same row column C

    No, it will not happen, the data are unique and the length is not 3, but more, it is just example. So, thanks for good remark, but pls do not worry about it.
    Last edited by sausis; 10-07-2015 at 02:11 AM.

  5. #5
    Valued Forum Contributor
    Join Date
    08-07-2014
    Location
    Quito, Ecuador
    MS-Off Ver
    Excel 2016 & 365, Windows 10
    Posts
    511

    Re: vba find text , move entire cell to the same row column C

    OK
    Assuming that "abc" does not repeat in any row, you can test the following code

    Please Login or Register  to view this content.

    in case you have a duplicate in the same row, it will take just the first from left
    Last edited by vichopalacios; 10-07-2015 at 12:43 PM.
    Barriers are there for those who don't want to dream

  6. #6
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: vba find text , move entire cell to the same row column C

    If you don't have formulas in any of the cells in column c or the cells you are searching you could use this.
    If you don't mind having the formulas replaced with their results, you could use this.

    It will run very fast on large data sets.

    If you have formulas and want to keep them in place, then don't use this.

    Please Login or Register  to view this content.
    Last edited by skywriter; 10-07-2015 at 06:00 PM.

  7. #7
    Valued Forum Contributor
    Join Date
    08-07-2014
    Location
    Quito, Ecuador
    MS-Off Ver
    Excel 2016 & 365, Windows 10
    Posts
    511

    Re: vba find text , move entire cell to the same row column C

    It will run very fast on large data sets.

    Hi skywriter
    I'm not used to work with large data sets, so...normaly I don't care about speed.
    I'd like to learn why your idea of comparing inside the array is faster than comparing cells themselves.
    As far as I can see, there is the main difference between both codes

    Vicho

    It was a good idea your aproach for lc and lr, as it covers the posibility of empty cells inside the db.

  8. #8
    Registered User
    Join Date
    11-29-2012
    Location
    Vilnius
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: vba find text , move entire cell to the same row column C

    Hello Vicho,
    Thank you very much. It works perfect.

  9. #9
    Registered User
    Join Date
    11-29-2012
    Location
    Vilnius
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: vba find text , move entire cell to the same row column C

    Hello Skywriter,
    Your code is to complicate for me, so I can not check why it is not working. It runs without errors, but nothing happens.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Find the last used cell in a row and move to a column in the same row - Move to next row
    By usafmeinweg in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-14-2015, 02:42 AM
  2. Find Text in Column then Move
    By Grahamfeeley in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-28-2014, 04:34 PM
  3. Find Text in Column then Move
    By Grahamfeeley in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-28-2014, 02:44 AM
  4. Search rows to find specific text and move to a different column ?
    By Udaipur99 in forum Excel - New Users/Basics
    Replies: 19
    Last Post: 03-19-2014, 01:11 PM
  5. Replies: 0
    Last Post: 06-05-2013, 01:18 PM
  6. Replies: 4
    Last Post: 11-13-2012, 02:16 PM
  7. Need to find text in column U and move it 19 columns to the left
    By ed_the_fed in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2012, 10:05 PM

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