+ Reply to Thread
Results 1 to 24 of 24

How to enter Value "skip" in same row at column AA when TargetCell was found

  1. #1
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    How to enter Value "skip" in same row at column AA when TargetCell was found

    Hello All,
    I'm trying to enter value to a certain Column to each TargetCell but don't know how:
    The TargetCell could be any Cell at difference Row/Column., whenever TargetCell was found then I want to enter value "Skip" at same row but column AA.
    Please Login or Register  to view this content.
    Regards,
    tt3

  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 enter Value "skip" in same row at column AA when TargetCell was found

    How do you declare the variable?

    Can you post the rest of the code?
    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
    Valued Forum Contributor wenqq3's Avatar
    Join Date
    04-01-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    868

    Re: How to enter Value "skip" in same row at column AA when TargetCell was found

    No sure is this what you mean.
    Please Login or Register  to view this content.
    -If the problem is solved, please mark your thread as Solved: Click Thread Tools above your first post, select "Mark your thread as Solved".

    -Always upload a workbook before start your question
    To attach a file, push the button with the paperclip (or scroll down to the Manage Attachments button), browse to the required file, and then push the Upload button.

    +++ If my answer(s) helped you, please add me reputation by click on * +++

  4. #4
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: How to enter Value "skip" in same row at column AA when TargetCell was found

    @wenqq3: Thank you for your time but it's not what i'm looking for or I may not understand your code.
    @Solus: Please see sample in below:

    Please Login or Register  to view this content.
    *Red text in code is for REF. only.

    Let says "Passed" is in Cell K8 then I want enter "Skip" in cell AA8
    "Passed" is in Cell M10 then I want enter "Skip" in cell AA10
    Regards,
    tt3

  5. #5
    Valued Forum Contributor wenqq3's Avatar
    Join Date
    04-01-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    868

    Re: How to enter Value "skip" in same row at column AA when TargetCell was found

    Maybe this.
    My understanding of your code and your comment is, whenever there is a "Passed" in any cell of K100:P100, then AA100 is "Skip"

    Please Login or Register  to view this content.

  6. #6
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: How to enter Value "skip" in same row at column AA when TargetCell was found

    Please try

    Please Login or Register  to view this content.
    If you like my contribution click the star icon!

  7. #7
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: How to enter Value "skip" in same row at column AA when TargetCell was found

    Both codes works and now I'm facing another problem:

    I have a varies of Passed-1 through Passed-9 and how to solve this.

    This line does not work
    Please Login or Register  to view this content.
    Regards,
    tt3

  8. #8
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: How to enter Value "skip" in same row at column AA when TargetCell was found

    This should work

    Please Login or Register  to view this content.

  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 enter Value "skip" in same row at column AA when TargetCell was found

    You can also try:
    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: How to enter Value "skip" in same row at column AA when TargetCell was found

    @OllieB: It does not work & can you check it or I did it wrong?
    Please Login or Register  to view this content.
    @Solus: Both lines work and can you explain why below line work? (Try to learn)
    Please Login or Register  to view this content.
    Regards,
    tt3

  11. #11
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: How to enter Value "skip" in same row at column AA when TargetCell was found

    The statement should work unless the value in the cell does not equal "Passed-"; but for example " Passed-" or "Passed -". The left statement takes the first seven positions from the cell value so if the cell contains anything else it will not result in True

  12. #12
    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 enter Value "skip" in same row at column AA when TargetCell was found

    InStr is a built in function that checks if 1 string is present in the string of the next ( In + String = InStr). This function returns a number value representing the digit the beginning of the string is found. InStr("IsItHere", "It") would return 3.

    The reason I suggested this method, I find its sometimes troublesome to include special characters inside a string you're searching with. Such as the - in "Passed-". Its probably not a real issue, just a personal opinion.

  13. #13
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: How to enter Value "skip" in same row at column AA when TargetCell was found

    @OlliieB: It work when I change to:
    Please Login or Register  to view this content.
    @Solus: Thank for your explanation but not sure why > 0

    Same issue but different situation and how to modify "First" => "First-*" (Code provided by member in this forum)

    Please Login or Register  to view this content.
    Regards,
    tt3

  14. #14
    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 enter Value "skip" in same row at column AA when TargetCell was found

    Because if the 2nd string is NOT found in the first string then InStr will return a 0. Such as InStr("IsItHere", "Not"). Not isn't included in the string so this would return 0. You want to affect the rows where it IS found. Therefore you only want to affect rows where it is > (greater than) 0.


    e/ In the effort of being complete with the explanation I suppose I should add: You don't NEED the > 0. You can leave it simply
    Please Login or Register  to view this content.
    I like to include the > 0 to be explicit. To me personally, it makes the code easier to read and easier to edit later.
    Last edited by Solus Rankin; 10-02-2013 at 04:21 PM. Reason: more info

  15. #15
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: How to enter Value "skip" in same row at column AA when TargetCell was found

    and how to modify "First" => "First-*" because code does not recognized "First-1" (Code provided by member in this forum)

    Please Login or Register  to view this content.
    Regards,
    tt3

  16. #16
    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 enter Value "skip" in same row at column AA when TargetCell was found

    You'd have to put that code in context. Its a constant declaration but I don't know what you're doing with it now or what you'd like to do with it.

  17. #17
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: How to enter Value "skip" in same row at column AA when TargetCell was found

    The code was provided by member in this forum but some how does not work because code does not recognized the text "First" since the true text is "First-1". My question is there anyway how to modify that line to detect "First-1"

    Regards,
    tt3

  18. #18
    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 enter Value "skip" in same row at column AA when TargetCell was found

    I don't know how its being used so this is best guess
    Please Login or Register  to view this content.

  19. #19
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: How to enter Value "skip" in same row at column AA when TargetCell was found

    Hi Solus,
    Your guess is corect but that does not work with
    "First-2"
    or
    "First-3"
    and I'm looking for code how to work with all "First-n"
    Regards,
    tt3

  20. #20
    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 enter Value "skip" in same row at column AA when TargetCell was found

    I can't figure that out unless you post the whole code. all the line you posted does is declare a constant. It doesn't take any action. Without posting the whole code I don't know what s supposed to happen to the constant.

  21. #21
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: How to enter Value "skip" in same row at column AA when TargetCell was found

    Here you go:
    Please Login or Register  to view this content.
    Regards,
    tt3

  22. #22
    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 enter Value "skip" in same row at column AA when TargetCell was found

    Okay, now I'm getting the picture. Can you describe the idea of what needs to be achieved with this code?

  23. #23
    Forum Contributor
    Join Date
    08-14-2012
    Location
    USA
    MS-Off Ver
    Excel 2007, MS 365 (Windows 10 Pro 64-bit)
    Posts
    810

    Re: How to enter Value "skip" in same row at column AA when TargetCell was found

    The code work when text "First" was found but I would like to modify the code to work with any text from "First-1" thru "First-9".

    Regards,
    tt3

  24. #24
    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 enter Value "skip" in same row at column AA when TargetCell was found

    I won't know how to edit it without fully understanding what you're trying to achieve. You would like to look through every cell in the used range and check for the string "First-"? What would you like to happen if its found?

+ 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. [SOLVED] Instead of showing #N/A and #REF!, i want the result show as "Not Found" and "Found"
    By DonnyLau in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-11-2013, 08:58 AM
  2. Replies: 3
    Last Post: 04-14-2013, 11:53 PM
  3. Replies: 1
    Last Post: 09-04-2012, 05:40 PM
  4. [SOLVED] How to Count number of "Error" and "OK" after the word "Instrument" found in table row
    By eltonlaw in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2012, 06:26 AM
  5. Replies: 2
    Last Post: 05-05-2008, 04:51 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