Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

find in which column is the value

Status
Not open for further replies.

2much4u

Technical User
Jul 4, 2005
8
0
0
SK
hi
in need to find a column number which contains the value specified
there certainly is only one column like that in the chart

i'm trying this:

Dim c1 As Long
Dim p1 As Range
Set p1 = Worksheets(1).Range("b1:cv1").Find("hi", LookIn:=xlValues)
c1 = p1.Column

Debugger stops at the last line with error:
Object variable or With block variable not set

i just need to identify the column starting with "hi" to use its other rows

thans for any help!
 


Hi,
Code:
Dim c1 As Long
Dim p1 As Range
Set p1 = Worksheets(1).Range("b1:cv1").Find("hi", LookIn:=xlValues)
if not p1 is nothing then _
   c1 = p1.Column


Skip,
[sub]
[glasses] [red][/red]
[tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top