mercredi 21 septembre 2016

If a value is equal to a set value X, then the the adjacent row/column will be Given a name

I want to start checking row 2 column 2 for certain values. All of these values will have a name. Some of the values have the same name. I'd like to place the name in the adjacent column starting at A2 and filling the rest of the column with the corresponding name.

I've attached a picture to show what I mean as well as my attempt at code. Note I haven't tried to do it for the whole column as I was just trying to get the first few cells done first to make it easier on myself.

Picture of the problem

Thanks ahead of time

    Sub NameTest()
'Dim cell As Range
'Dim Nighthawk As String
'Dim value1 As String, value2 As String, Value3 As String

'Nighthawk = value1 & "," & value2 & "," & Value3

'value1 = 58475283
'value2 = 73797342
'Value3 = 58475286

'For Each cell In Range("B2:250")
'If InStr(Nighthawk, Range("B2")) <> 0 Then

'For Each cell In Range("A2:250")
'cell = "Nighthawk"

''End If

'Next cell

'End

Aucun commentaire:

Enregistrer un commentaire