Steve,
I did not understand your complete question, but without
wasting time i want to say what i have assumed.
You will need to exploit excel COM object to read through the excel
values.
For Eg :
sExcelpath = "Path of your excel sheet"
Set oExcel = CreateObject("Excel.Application")
Set oWorkbook = oExcel.Workbooks.Open(sExcelpath)
Set oWorksheet = oWorkbook.Worksheets(1) ' Hoping you are using the
first worksheet
colcount = oWorksheet.UsedRange.Columns.Count
msgbox colcount
For i = 1 to colcount
colname = oWorksheet.Cells(1, i).Value
msgbox colname
If colname = "Nav1" Then
colvalue = i
msgbox colvalue
End If
Next
oExcel.Quit
colvalue contains the value where it finds the required column name.
Was this what you were looking for ?
ug 7, 6:06 pm, Steve <[email protected]> wrote:
> I need to find the first column that = Nav1 and place that
> column number into a variable so I can use it again later.
>
> EX:
>
> Here are some columns in my excel
>
> A B C D E Nav1 Nav2 Nav3 Nav4
>
> So I would need some code that would go into excel and come
> back with the number 6. Since Nav1 starts on column 6.
>
> Note: The column location for Nav1 can change.
>
> Thanks,
> Steve
>
> I found something similar here, but it isn't exactly what I am looking
> for.
>
> http://funandknowledge.blogspot.com/2009/01/to-retrieve-column-names-...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
-~----------~----~----~----~------~----~------~--~---