PDA

View Full Version : [SOLVED] How to get the absolute column number of given cell value from the range C2:K2



quetzal
05-03-2016, 09:11 AM
Hello,

the title pretty much explains the issue I need to solve.
I've tried to search for the answer but without any good result.

Let say I have a variable A=54 which is located in the range C2:K2.
I want to find on which position is the variable located - this should be quite easy but I don't know how to detect the position and assign it to the variable B.

Any help is appreciated
Thank you so much

quetzal
05-03-2016, 10:09 AM
Dim A, arr, B

arr = Sheets("SETUP MATRIX").Range("C2:K2")
A = Sheets("ORDERS").Range("B5").Value + 2
B = Application.Match(A, arr, False)

...yup , it was easy

jolivanes
05-04-2016, 09:39 AM
Would this do it also?

Dim A As Long, B As Long
A = Sheets("ORDERS").Range("B5").Value + 2
B = Sheets("SETUP MATRIX").Rows(2).Find(A, , , 1).Column

quetzal
05-16-2016, 06:12 AM
Would this do it also?

Dim A As Long, B As Long
A = Sheets("ORDERS").Range("B5").Value + 2
B = Sheets("SETUP MATRIX").Rows(2).Find(A, , , 1).Column


Sorry, It did not work for some reason....