Consulting

Results 1 to 2 of 2

Thread: Change cell value within a row depending on other cell values within same row

  1. #1

    Change cell value within a row depending on other cell values within same row

    I am creating a macro enable spreadsheet to help me keep track of support tickets that I am currently working on in my engineering position.

    I have 16 columns that provide information about each support ticket, such as Date, Serial Number of the device, Device location and so forth. A new row is a new support ticket.

    Let's say we are working with row 50.

    Column E represents the status of the device for which the ticket has been opened. Such as Deployed, Configure, and Floor Install.

    Column F represents the device type such as Exalogic, and Exadata

    Column K represents whether or not I need to create a special ticket depending on the value of E "OR" the value of F. Column K's values can be either yes or no.


    This is what I have thus far and it does work with the column E range.

    Dim rng As Range
    Dim cellE
    Dim cellF
    
    If Not Intersect(Range("E12:E100"), Target) Is Nothing Then
    Application.EnableEvents = False
    
         For Each rng In Intersect(Range("E12:E100"), Target)
    
         Set cellE = Range("E" & rng.Row)
         Set cellK = Range("K" & rng.Row)
    
         If Range("E" & rng.Row) = "Configure" Then
                Range("K" & rng.Row) = "No"
         ElseIf Range("E" & rng.Row).Value Like "*Floor*" Then
                Range("K" & rng.Row) = "No"
    
         Else
                Range("K" & rng.Row) = ""
            End If
            
    Next rng
    Application.EnableEvents = True
        
    End If
    However, if I try adding in the F range, nothing works:

    If Not Intersect(Range("E12:E100"), Range("F12:F100"), Target) Is Nothing Then
         Application.EnableEvents = False
    
         For Each rng In Intersect(Range("E12:E100"), Range("F12:F100"), Target)
    
         Set cellE = Range("E" & rng.Row)
         Set cellF = Range("F" & rng.Row)
         Set cellK = Range("K" & rng.Row)
    
         If Range("E" & rng.Row) = "Configure" Then
                Range("K" & rng.Row) = "No"
         ElseIf Range("E" & rng.Row).Value Like "*Floor*" Then
                Range("K" & rng.Row) = "No"
         ElseIf Range("F" & rng.Row).Value Like "*Exa*" Then
                'Range("K" & rng.Row) = "Not Needed"
         Else
                Range("K" & rng.Row) = ""
         End If
            
    Next rng
        Application.EnableEvents = True
        
    End If
    Any help is greatly appreciated

  2. #2
    VBAX Tutor
    Joined
    Jan 2008
    Posts
    262
    Location
    Is the point that Range("E12:E100") never intersects Range("F12:F100")?

    Do you want something like,
    Intersect(Union(Range("E12:E100"), Range("F12:F100")), Target) ? Don't know if this works, just thinking logically.

    sassora

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •