(Solved) – Insert Value from One Column to a New Blank Column Based on Score Value

(solved)-–-insert-value-from-one-column-to-a-new-blank-column-based-on-score-value

I want to insert the name of a company from one column into a new blank one, only if the corresponding value in the “Score” column is equal to or less than 5.

A simple Vlookup cannot be used because this template has to deal with potentially dynamic data, i.e. the column location of the “Score” column may change next quarter etc.

VBA does not alert to any bugs in the code below, but when it is run nothing happens.

Any help or guidance is greatly appreciated!

”’

Sub MacroX()

Dim Score_Col As Long
For i = 1 To NumCols
    If Cells(1, i).Value = "SCORE" Then Score_Col = i
Next

For i = 2 To NumRows
    If Cells(i, Score_Col).Value <= 5 Then Cells(i, 28).Value = Cells(i, 2).Value
Next

End Sub

'''

Leave a Reply

Your email address will not be published. Required fields are marked *