+ Reply to Thread
Results 1 to 14 of 14

How to add a text in a cell below a searched cell?

  1. #1
    Registered User
    Join Date
    02-29-2012
    Location
    gdansk POland
    MS-Off Ver
    Excel 2010
    Posts
    9

    How to add a text in a cell below a searched cell?

    Hello, I wonder if it is possible to create a macro that would insert e.g. a character "Z" in a cell below every instance of a cell with a character "X"?

    Let's say I have a column C and within this column cells with a letter X appear from time to time. I want a macro to search Xs and insert Zs below every cell with Xs.
    I have:
    X


    X




    X

    I want:

    X
    Z

    X
    Z



    X
    Z

    If a second macro could be created but with inserting Ys above each cell with X my satisfaction would be immense.

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: How to add a text in a cell below a searched cell?

    Please Login or Register  to view this content.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: How to add a text in a cell below a searched cell?

    Caesar,

    If you are happy with that solution, please mark the thread as [SOLVED]. If you have other questions please start a separate thread for them with an appropriate title, so that other users can find it easily.

    I'm sure there are plenty of people that would like to help.

  4. #4
    Registered User
    Join Date
    02-29-2012
    Location
    gdansk POland
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: How to add a text in a cell below a searched cell?

    Solus, thank you, but in the bottom of my first post I asked for a similar macro with inserting Ys above each instance of X. If I get the second macro I will mark the thread as "SOLVED" if first you instruct me how to do that :-) I'm sorry, but I'm quite new here. I hope you got my reputation.

  5. #5
    Registered User
    Join Date
    02-29-2012
    Location
    gdansk POland
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: How to add a text in a cell below a searched cell?

    OK, I've found it. "Thread tools".

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How to add a text in a cell below a searched cell?

    FWIW:

    Please Login or Register  to view this content.

  7. #7
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: How to add a text in a cell below a searched cell?

    Look like John has an option.

    Or:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    02-29-2012
    Location
    gdansk POland
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: How to add a text in a cell below a searched cell?

    Thnx John but it doesn't work. Your macro is to add both Y above and Z below. That's fine. There are circumstances that I need such a situation but also I need macro that would add e.g. Y only above X.

  9. #9
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: How to add a text in a cell below a searched cell?

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by Solus Rankin; 07-26-2013 at 02:46 PM.

  10. #10
    Registered User
    Join Date
    02-29-2012
    Location
    gdansk POland
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: How to add a text in a cell below a searched cell?

    Solus, your code works fine :-) So now I need a macro that only adds Ys above Xs and not Zs below :-)

  11. #11
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: How to add a text in a cell below a searched cell?

    I see what you're saying now. See post #9.

  12. #12
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How to add a text in a cell below a searched cell?

    OK.

    Y
    Please Login or Register  to view this content.
    Z
    Please Login or Register  to view this content.
    Both
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    02-29-2012
    Location
    gdansk POland
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: How to add a text in a cell below a searched cell?

    Solus, I'm fully satisfied. You were very helpful. Now, I can close the thread. John, I also thank you for your involvement. Thanks to you both.

  14. #14
    Registered User
    Join Date
    02-29-2012
    Location
    gdansk POland
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: How to add a text in a cell below a searched cell?

    John, I'm very sorry. You last codes are perfect - I thought it was Solus who posted them. You both were very helpful and professional :-)

+ 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. Macro to search and highlight a cell prior to the searched cell
    By gjccks in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-15-2013, 01:51 PM
  2. [SOLVED] Pull the information of a searched cell up as well
    By FCarv in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-17-2012, 11:02 AM
  3. Excel 2007 : #NAME? when searched cell is empty
    By Kingswood in forum Excel General
    Replies: 5
    Last Post: 10-28-2011, 01:58 PM
  4. Count searched strings only once per cell
    By ElmerS in forum Excel General
    Replies: 12
    Last Post: 09-26-2010, 09:41 AM
  5. [SOLVED] Macro to shade row of searched cell
    By tikyle in forum Excel General
    Replies: 4
    Last Post: 11-17-2005, 07:00 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