+ Reply to Thread
Results 1 to 2 of 2

If cell to left contains "x" then enter "y" in active cell. Loop with multiple x's & y's

  1. #1
    Registered User
    Join Date
    08-11-2009
    Location
    Gilbert, Arizona, USA
    MS-Off Ver
    Excel 2003
    Posts
    82

    If cell to left contains "x" then enter "y" in active cell. Loop with multiple x's & y's

    Hey guys,
    I could use some help with the following logic. I have been able to define the count of rows with "x" below but I can't seem to refer back to it correctly. I would like to create a loop that will search the cell in column H for a string, then put a certain string in the same row for column I (see example 2 for my recorded and simplified code).

    1. define last row. code I'm using:
    x = Range("H2").End(xlDown).Offset(-1, 0).Row

    2. if H2 contains "cam" make I2 say "cam charges" and copy it down the column as applicable
    Range("I2").FormulaR1C1 = "=IF(ISNUMBER(SEARCH(""CAM"",RC[-1])),""CAM Charges"","""")"
    Range("I2").Copy
    Range("H2").Select
    Selection.End(xlDown).Select
    Range("I27751").Select
    Range(Selection, Selection.End(xlUp)).Select
    ActiveSheet.Paste
    Selection.End(xlUp).Select
    ' filter column to only include blanks
    ActiveSheet.Range("$A$1:$J$27751").AutoFilter Field:=9, Criteria1:="="



    In the end, what I am hoping to do is create a list of items to run through each row until the last row, for example:
    if I2 contains "a" enter value "r" in H2
    if I2 contains "b" enter value "r" in H2

    if I2 contains "c" enter value "s" in H2
    if I2 contains "d" enter value "s" in H2

    next row (ex I3)
    until last row.

    The code I am using isn't scaleable and will be too hard to update.
    Does this make any sense?
    thanks!
    Curbster

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: If cell to left contains "x" then enter "y" in active cell. Loop with multiple x's & y

    You could try to use this code:
    Please Login or Register  to view this content.
    Regards,
    Antonio

+ 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] how to replace the "Alt-Enter" character in a cell with sway "@"
    By jmac1947 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-04-2014, 05:55 AM
  2. Adding multiple "find" with "left" /"Right"
    By Daniel1 in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 02-22-2014, 04:33 PM
  3. [SOLVED] Need VBA code to replicate "Enter" key from active cell
    By PeteABC123 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-17-2014, 02:48 PM
  4. [SOLVED] Formula Needed to fill multiple cells with "No" when the word "No" is entered into a cell
    By excelteam777 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-09-2013, 05:36 PM
  5. "Form and macro" to delete "Active" cell contents.
    By wanty in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-22-2013, 11:33 PM
  6. Change "Parent" cell based on results of multiple "Children" cells
    By ccowman in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 12-14-2012, 02:33 AM
  7. [SOLVED] Can I enter a "Y" and return "Yes" in the same cell? PART 2
    By rbbbbeee in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-16-2006, 07:25 AM
  8. Replies: 5
    Last Post: 06-26-2006, 09:23 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