+ Reply to Thread
Results 1 to 2 of 2

AutoComplete based on value in either of 3 cells

Hybrid View

  1. #1
    Registered User
    Join Date
    06-05-2006
    Posts
    16

    AutoComplete based on value in either of 3 cells

    I have been struggling with a change to a worksheet that has affected code that I previously used (see below). The code originally looked at one column and then, based on the value, placed the appropriate text in the subsequent adjacent cells. However, my spreadsheet may now have values in one, two or three columns (D,E and/or F). I have made several attempts at adjusting this code and am getting nowhere fast (mostly due to my lack of skill).

    Any suggestions would be enormously appreciated.

    Thanks very much. Original code below:

    Sub AutoComplete()
    'ActiveSheet.Unprotect Password:=""
    
    Dim rngY As Range
    Dim rng As Range
    
    Set rngY = Range("D12:D" & Range("D" & Range("A:A").Rows.Count).End(xlUp).Row)
     
    Application.ScreenUpdating = False
    Application.EnableEvents = False
     
    For Each rng In rngY
     
    If LCase(rng.Value) = "" Then
            rng.Offset(0, 3).Value = ""
    ElseIf LCase(rng.Value) = "0" Then
            rng.Offset(0, 3).Value = "Not Applicable"
            rng.Offset(0, 4).Value = "Not Applicable"
            rng.Offset(0, 5).Value = "Not Applicable"
    ElseIf LCase(rng.Value) >= 1 Then
            rng.Offset(0, 3).Value = "Please Complete"
            rng.Offset(0, 4).Value = "Please Complete"
            rng.Offset(0, 5).Value = "Outstanding"
            
    End If
    Next rng
     
    'ActiveSheet.Protect Password:="", _
    'DrawingObjects:=True, Contents:=True, Scenarios:=True
     
     
    Application.ScreenUpdating = True
    Application.EnableEvents = True
     
    End Sub
    Last edited by CindyG; 06-17-2011 at 10:13 AM. Reason: clarification

  2. #2
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: AutoComplete based on value in either of 3 cells

    I don't see what is wrong with this coe. It does what it is supposed to do.
    What exactly do you need it to do? I'm not sure I understand.
    Could you attached a sample file and explain what is not working as you would like?
    It would help us a lot.
    regards
    Pierre

+ Reply to Thread

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