+ Reply to Thread
Results 1 to 2 of 2

shorter version of this validation code

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-07-2016
    Location
    Manila
    MS-Off Ver
    365
    Posts
    292

    shorter version of this validation code

    Hi,

    Will need your help in re-writing this code (shorter version)

    If CCI_OE.Range("OE_Rating1").Value = "Yes" And CCI_OE.Range("OE_Comment1").Value = "" Then
                CCI_OE.Range("OE_Comment1").Value = "NA"
            End If
            If CCI_OE.Range("OE_Rating2").Value = "Yes" And CCI_OE.Range("OE_Comment2").Value = "" Then
                CCI_OE.Range("OE_Comment2").Value = "NA"
            End If
            If CCI_OE.Range("OE_Rating3").Value = "Yes" And CCI_OE.Range("OE_Comment3").Value = "" Then
                CCI_OE.Range("OE_Comment3").Value = "NA"
            End If
            If CCI_OE.Range("OE_Rating4").Value = "Yes" And CCI_OE.Range("OE_Comment4").Value = "" Then
                CCI_OE.Range("OE_Comment4").Value = "NA"
            End If
            If CCI_OE.Range("OE_Rating5").Value = "Yes" And CCI_OE.Range("OE_Comment5").Value = "" Then
                CCI_OE.Range("OE_Comment5").Value = "NA"
            End If
            If CCI_OE.Range("OE_Rating6").Value = "Yes" And CCI_OE.Range("OE_Comment6").Value = "" Then
                CCI_OE.Range("OE_Comment6").Value = "NA"
            End If
            If CCI_OE.Range("OE_Rating7").Value = "Yes" And CCI_OE.Range("OE_Comment7").Value = "" Then
                CCI_OE.Range("OE_Comment7").Value = "NA"
            End If
            If CCI_OE.Range("OE_Rating8").Value = "Yes" And CCI_OE.Range("OE_Comment8").Value = "" Then
                CCI_OE.Range("OE_Comment8").Value = "NA"
            End If
            If CCI_OE.Range("OE_Rating9").Value = "Yes" And CCI_OE.Range("OE_Comment9").Value = "" Then
                CCI_OE.Range("OE_Comment9").Value = "NA"
            End If
            If CCI_OE.Range("OE_Rating10").Value = "Yes" And CCI_OE.Range("OE_Comment10").Value = "" Then
                CCI_OE.Range("OE_Comment10").Value = "NA"
            End If
            If CCI_OE.Range("OE_Rating11").Value = "Yes" And CCI_OE.Range("OE_Comment11").Value = "" Then
                CCI_OE.Range("OE_Comment11").Value = "NA"
            End If
            If CCI_OE.Range("OE_Rating12").Value = "Yes" And CCI_OE.Range("OE_Comment12").Value = "" Then
                CCI_OE.Range("OE_Comment12").Value = "NA"
            End If
            If CCI_OE.Range("OE_Rating13").Value = "Yes" And CCI_OE.Range("OE_Comment13").Value = "" Then
                CCI_OE.Range("OE_Comment13").Value = "NA"
            End If
            If CCI_OE.Range("OE_Rating14").Value = "Yes" And CCI_OE.Range("OE_Comment14").Value = "" Then
                CCI_OE.Range("OE_Comment14").Value = "NA"
            End If
            If CCI_OE.Range("OE_Rating15").Value = "Yes" And CCI_OE.Range("OE_Comment15").Value = "" Then
                CCI_OE.Range("OE_Comment15").Value = "NA"
            End If
            If CCI_OE.Range("OE_Rating16").Value = "Yes" And CCI_OE.Range("OE_Comment16").Value = "" Then
                CCI_OE.Range("OE_Comment16").Value = "NA"
            End If
            If CCI_OE.Range("OE_Rating17").Value = "Yes" And CCI_OE.Range("OE_Comment17").Value = "" Then
                CCI_OE.Range("OE_Comment17").Value = "NA"
            End If
            If CCI_OE.Range("OE_Rating18").Value = "Yes" And CCI_OE.Range("OE_Comment18").Value = "" Then
                CCI_OE.Range("OE_Comment18").Value = "NA"
            End If
            If CCI_OE.Range("OE_Rating19").Value = "Yes" And CCI_OE.Range("OE_Comment19").Value = "" Then
                CCI_OE.Range("OE_Comment19").Value = "NA"
            End If
            If CCI_OE.Range("OE_Rating20").Value = "Yes" And CCI_OE.Range("OE_Comment20").Value = "" Then
                CCI_OE.Range("OE_Comment20").Value = "NA"
            End If
            If CCI_OE.Range("OE_Rating21").Value = "Yes" And CCI_OE.Range("OE_Comment21").Value = "" Then
                CCI_OE.Range("OE_Comment21").Value = "NA"
            End If
    Thanks in advance!

  2. #2
    Forum Contributor
    Join Date
    06-07-2016
    Location
    Manila
    MS-Off Ver
    365
    Posts
    292

    Re: shorter version of this validation code

    Closing, already found a solution:

    Dim aaaa As Long
            
                For aaaa = 1 To 20
                    If CFA_CM.Range("CFA_Rating" & aaaa).Value = "Yes" And CFA_CM.Range("CFA_Comment" & aaaa).Value = "" Then
                        CFA_CM.Range("CFA_Comment" & aaaa).Value = "NA"
                    End If
                Next

+ 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. shorter version of this formula
    By aarona in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-19-2018, 04:15 AM
  2. [SOLVED] shorter version of this code
    By aarona in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-06-2018, 09:11 AM
  3. shorter version of this line of code
    By aarona in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-27-2017, 08:00 AM
  4. [SOLVED] shorter version of this code
    By aarona in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-20-2017, 01:46 AM
  5. [SOLVED] shorter version of this line?
    By aarona in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-17-2017, 04:51 AM
  6. Shorter version of this........
    By wrtrblk in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 03-20-2013, 12:17 AM
  7. shorter version of formula
    By spirodem in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-31-2005, 09:22 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