Search column by its name

Joined
Jul 9, 2014
Messages
11
Reaction score
0
Points
0
How can i search column by it header name?

Code:
processrow = Matchup(.Cells(i, "J").value, target.Columns(1))
            If processrow > 0 Then

what i mean is, currently this code will search column 'J' but i want it search by its name for example 'Process'.
instead of looking for 'J', it will find 'Process'

Thanks.
 

p45cal

Super Moderator
Staff member
Joined
Dec 16, 2012
Messages
2,200
Reaction score
16
Points
38
Excel Version(s)
365
but i want it search by its name for example 'Process'. instead of looking for 'J', it will find 'Process'
I've never heard of the function MatchUp so it's probably a function you have somewhere as code. At a guess it could be:

processrow = Matchup("Process", target.Columns(1))


or less likely:
processrow = Matchup(.Cells(i, "J").value, "Process")
We'd really need to see a bit more surrounding code and the MatchUp function too.
 
Joined
Jul 9, 2014
Messages
11
Reaction score
0
Points
0
Sorry for not giving you full code
I have example like below

let say my C column is 'Address.
how to replace it

Code:
yearidx = Year(.Cells(i, "C").value) - Application.Min(target.Rows(1))                
monthidx = Month(.Cells(i, "C").value)
                If Application.CountA(target.Rows(processrow)) > 1 Then
                    processrow = processrow + 1
                    target.Rows(processrow).Insert
                End If

thanks.
 

p45cal

Super Moderator
Staff member
Joined
Dec 16, 2012
Messages
2,200
Reaction score
16
Points
38
Excel Version(s)
365
I understand even less now!
 
Top