View Single Post
 
Old 08-23-2019, 03:42 AM
lmoir87 lmoir87 is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Jul 2014
Posts: 7
lmoir87 is on a distinguished road
Default

Hi Greg, sorry for the delay in replying.

I have put together this code which is working for a stored 'Score', however i want to be able to assign 6 word values to 'Score' and then for each row(j) change the value of 'Score'. Where i am stuck is can i store the values for example as numbers and then have For each J, Score = Score +1, or something like that?

Code:
'Loop to select each row in the current table
    For J = 3 To NumRows
        
        'Score reference has to change here for each J
        
'Loop to select each cell in the current row
        For K = 2 To (NumCols - 2)
            'Select the cell to check
            Selection.Tables(1).Rows(J).Cells(K).Select
            'Copy any text in the cell
            ChkTxt = Selection.Text
            ChkTxt = Left(ChkTxt, Len(ChkTxt) - 2)
            'Check if text matches cell
            If (ChkTxt <> Score) Then Selection.Shading.BackgroundPatternColor = -570363137 'very light grey
            If (ChkTxt <> Score) Then Selection.Font.Bold = False
            If (ChkTxt <> Score) Then Selection.Font.ColorIndex = wdGray25 ' text grey
        Next K
    Next J
Reply With Quote