PDA

View Full Version : Solved: Column Number



jsc0624
04-12-2007, 12:36 AM
Hi to all,

How to determine the column number in vba?

Thanks in advance

This code doesnt work:


If Cells(1, Z).Value = "WORKORDER_NUMBER" Then
A = ActiveCell.Column
End If

Suppose to be the value of A must be 1, because the value of A1 is WORKORDER_NUMBER, but then it returns 21.

Jan Karel Pieterse
04-12-2007, 12:41 AM
you use cells(1,z).value to detect the proper cell, but then use activecell.column to get at the column, seems to me you should use cells(1,z).Column?

Bob Phillips
04-12-2007, 12:51 AM
or even pickup the value in Z, that is your column number.