+ Reply to Thread
Results 1 to 13 of 13

Can anybody help with adding a Y to cells in column U, if there is data in column T

Hybrid View

Pat1009 Can anybody help with adding... 07-08-2015, 05:23 PM
Old4xford Re: Can anybody help with... 07-08-2015, 05:26 PM
Pat1009 Re: Can anybody help with... 07-08-2015, 05:29 PM
Pat1009 Re: Can anybody help with... 07-08-2015, 09:32 PM
StuCram Re: Can anybody help with... 07-08-2015, 10:00 PM
Pat1009 Re: Can anybody help with... 07-09-2015, 07:52 AM
StuCram Re: Can anybody help with... 07-09-2015, 09:24 AM
Pat1009 Re: Can anybody help with... 07-09-2015, 05:35 PM
StuCram Re: Can anybody help with... 07-09-2015, 06:44 PM
Pat1009 Re: Can anybody help with... 07-09-2015, 09:31 PM
StuCram Re: Can anybody help with... 07-09-2015, 10:01 PM
Pat1009 Re: Can anybody help with... 07-09-2015, 10:35 PM
StuCram Re: Can anybody help with... 07-09-2015, 11:51 PM
  1. #1
    Registered User
    Join Date
    07-07-2015
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    42

    Can anybody help with adding a Y to cells in column U, if there is data in column T

    how do I add the letter Y to column (U).
    I need it to check if there is any data in the column to the left (column T), and if there is, Insert a Y in column U.

  2. #2
    Registered User
    Join Date
    03-12-2014
    Location
    Central Texas
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Can anybody help with adding a Y to cells in column U, if there is data in column T

    Put this in U1 and drag-down:
    =IF(T1<>"","Y","")
    Oh! I get it. I need rep--->҉

  3. #3
    Registered User
    Join Date
    07-07-2015
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    42

    Re: Can anybody help with adding a Y to cells in column U, if there is data in column T

    Thank you, but I need it in the VBA form.

  4. #4
    Registered User
    Join Date
    07-07-2015
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    42

    Re: Can anybody help with adding a Y to cells in column U, if there is data in column T

    I am getting closer. I now have this...
    ws1.Range("A" & i & ":R" & i).Copy ws2.Rows(ws2.Cells(ws2.Rows.Count, 3).End(xlUp).Row + 1).Range("A1").Offset(RowOffset:=0, ColumnOffset:=1)

    The ColumnOffset is now working.
    The RowOffset is not. When I use RowOffset:=0, it still starts to paste on row 2 (I need it to start paste on row 3).
    When I use RowOffset:=1, it starts to paste on line 3, but then skips every other row when pasting.

    paste
    skip row
    paste
    skip row
    and so on.

    Any ideas?

  5. #5
    Valued Forum Contributor
    Join Date
    10-05-2014
    Location
    Regina, SK Canada
    MS-Off Ver
    Excel for Mac 11
    Posts
    330

    Re: Can anybody help with adding a Y to cells in column U, if there is data in column T

    Here's a short straight-forward macro that does the task, I think.
    Change the 1 in the FOR loop to whichever starting row you need.

    Sub check_col_T_and_put_Y_in_col_U()
    
      Dim lastRow As Long
      Dim row As Long
       
      Application.ScreenUpdating = False
      lastRow = ActiveSheet.Cells(Rows.Count, "T").End(xlUp).Row
    
      For row = 1 To lastRow
        If Cells(row, "T") <> "" Then Cells(row, "U") = "Y"
      Next row
      
      Application.ScreenUpdating = True
    End Sub

  6. #6
    Registered User
    Join Date
    07-07-2015
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    42

    Re: Can anybody help with adding a Y to cells in column U, if there is data in column T

    Thx Stew, this works. But if I wanted to change 1 part of it, to look in column "L" for anything less than (<) 240.00, and if it finds it, put "Y" in column "U", how would it look. It is only finding some of them. All values in row L is 0.1 to 0.63 right now, but this can change.

    For row = 2 To lastRow
    If Cells(row, "L") < "240.00" Then Cells(row, "U") = "Y"
    Next row

  7. #7
    Valued Forum Contributor
    Join Date
    10-05-2014
    Location
    Regina, SK Canada
    MS-Off Ver
    Excel for Mac 11
    Posts
    330

    Re: Can anybody help with adding a Y to cells in column U, if there is data in column T

    Remove the quotation marks around 240.00 so that the decision compares numbers not strings.

    For row = 2 To lastRow
       If Cells(row, "L").value < 240.00 Then Cells(row, "U") = "Y"
    Next row
    Hope this helps,
    - Stu

  8. #8
    Registered User
    Join Date
    07-07-2015
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    42

    Re: Can anybody help with adding a Y to cells in column U, if there is data in column T

    Stu, That worked.
    Do you know the code for >72 and <240 in the same line?
    This is the line I need to add >240 to....

     If ws1.Cells(i, 4) = "A" And ws1.Cells(i, 12) > 72 And ws1.Cells(i, 14) = "Standard" Then
    Last edited by Pat1009; 07-09-2015 at 06:34 PM.

  9. #9
    Valued Forum Contributor
    Join Date
    10-05-2014
    Location
    Regina, SK Canada
    MS-Off Ver
    Excel for Mac 11
    Posts
    330

    Re: Can anybody help with adding a Y to cells in column U, if there is data in column T

    Stu, That worked.
    Do you know if there is VBA code to Change the cell color and font color to Red in Column "V" if column "M" is > 240.00?


    _________________________________________________
    Try something like this…

    Sub check_Column_L()
    
      Dim lastRow As Long
      Dim row As Long
      Dim cellValue As Double
    
      lastRow = ActiveSheet.Cells(Rows.Count, "L").End(xlUp).row
      
      For row = 2 To lastRow
      
        cellValue = Cells(row, "L").Value
        
        If cellValue <= 240# Then
          Cells(row, "U") = "Y"
          Cells(row, "V").Font.Color = RGB(255, 0, 0)         ' red
          Cells(row, "V").Interior.Color = RGB(150, 250, 50)  ' lime green
        Else
          Cells(row, "U").ClearContents
          Cells(row, "V").Font.Color = RGB(0, 0, 0)           ' black
          Cells(row, "V").Interior.Color = RGB(255, 255, 255) ' white
        End If
        
      Next row
      
    End Sub

  10. #10
    Registered User
    Join Date
    07-07-2015
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    42

    Re: Can anybody help with adding a Y to cells in column U, if there is data in column T

    Thx Stu! This is good

  11. #11
    Valued Forum Contributor
    Join Date
    10-05-2014
    Location
    Regina, SK Canada
    MS-Off Ver
    Excel for Mac 11
    Posts
    330

    Re: Can anybody help with adding a Y to cells in column U, if there is data in column T

    Hi Pat.

    I just noticed that my sample code changed the cells in column V to red when the corresponding cell in column L was less than or equal to 240. You wanted greater than 240 and will need to adjust the decision and/or statements as you need. Will leave that exercise to you.

    If this previous posts have been helpful, please click the 'Add Reputation' button.
    - Stu

  12. #12
    Registered User
    Join Date
    07-07-2015
    Location
    Houston, TX
    MS-Off Ver
    2013
    Posts
    42

    Re: Can anybody help with adding a Y to cells in column U, if there is data in column T

    Yes,I saw that, thank you.

  13. #13
    Valued Forum Contributor
    Join Date
    10-05-2014
    Location
    Regina, SK Canada
    MS-Off Ver
    Excel for Mac 11
    Posts
    330

    Re: Can anybody help with adding a Y to cells in column U, if there is data in column T

    One last point - Color coding the cells can be accomplished with Conditional Formatting.
    Using that would have the advantage of immediate results without having to run a macro.
    - Some food for thought.

+ 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. Comparing cells in a column and adding result of comparison in cells of adjacent column
    By Lionel welshboy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-19-2013, 05:37 AM
  2. Help for adding static date in column B on import/pasting of data in Column A
    By Parijaat in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-18-2013, 05:34 AM
  3. Replies: 4
    Last Post: 10-31-2011, 04:33 PM
  4. Replies: 2
    Last Post: 07-20-2009, 08:52 PM
  5. Adding data of cells in one column and creating the additions in another
    By dberliner in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-03-2007, 10:12 AM

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