Results 1 to 3 of 3

amending some code to include an if clause.

Threaded View

Blake 7 amending some code to include... 04-02-2012, 11:58 AM
StephenR Re: amending some code to... 04-02-2012, 12:12 PM
Blake 7 Re: amending some code to... 04-03-2012, 09:16 AM
  1. #1
    Valued Forum Contributor Blake 7's Avatar
    Join Date
    10-01-2010
    Location
    Bogota, Colombia
    MS-Off Ver
    Excel 2010 64 bit and Excel 2007,
    Posts
    1,377

    amending some code to include an if clause.

    Good afternoon.

    I have some code below which as you can see puts the word "closed" into col g when a value is entered into col AF. This is fine however, I am trying to amend to code slightly to include.... if the status of col G is "Re-opened" and a date is entered into AF then G should say "re-opened closed"



    Private Sub Worksheet_Change(ByVal Target As Excel.Range)
        Dim rng As Range
        Dim rCell As Range
        Set rng = Range("AF10:AF5000")
        If Not Intersect(Target, rng) Is Nothing Then
            For Each rCell In Intersect(Target, rng).Cells
                If Len(rCell.Value) > 0 Then
                   ' MsgBox "Cell " & _
                           rCell.Address & " = PLEASE remember to change the complaint status to CLOSED"
                    ' OR USE
                     Application.EnableEvents = False
                     Cells(rCell.Row, "G").Value = "Closed"
                     Application.EnableEvents = True
                End If
            Next rCell
        End If
    
        Set rng = Nothing
    
    End Sub

    Thanks for looking
    Last edited by Blake 7; 04-03-2012 at 09:17 AM.
    Blake 7

    If your question has been answered, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

    If any member's response has helped to solve your problem, please consider using the scales icon on the top right of their post to show your appreciation.

    http://failblog.org/

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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