From: choo on
Hi,
I would like to verify the value of certain column header. How does the
code looks like?

eg.
check, if column J = "Product_Name", do A, else stop.
if column AC = "Price", do A, else stop.

Thank you.

choo
From: choo on
Just want add that they are all on row 1.

From: Dave Peterson on
This checks each field and will "run" the "do A" twice if both are found.

With worksheets("somesheetnamehere")
if lcase(.range("j1").value) = lcase("Product_Name") then
msgbox "do A"
end if
if lcase(.range("ac1").value) = lcase("Price") then
msgbox "do A"
end if
end with

or maybe you meant to check both headers and if either is ok, then do A???

With worksheets("somesheetnamehere")
if lcase(.range("j1").value) = lcase("Product_Name") _
or lcase(.range("ac1").value) = lcase("Price") then
msgbox "do A"
end if
end with

or maybe you meant to check both headers and if both are ok, then do A???

With worksheets("somesheetnamehere")
if lcase(.range("j1").value) = lcase("Product_Name") _
And lcase(.range("ac1").value) = lcase("Price") then
msgbox "do A"
end if
end with




choo wrote:
>
> Hi,
> I would like to verify the value of certain column header. How does the
> code looks like?
>
> eg.
> check, if column J = "Product_Name", do A, else stop.
> if column AC = "Price", do A, else stop.
>
> Thank you.
>
> choo

--

Dave Peterson
From: choo on
I apologize for the unclear question. I am looking for the first option in
your reply. Thanks Dave!

choo

"Dave Peterson" wrote:

> This checks each field and will "run" the "do A" twice if both are found.
>
> With worksheets("somesheetnamehere")
> if lcase(.range("j1").value) = lcase("Product_Name") then
> msgbox "do A"
> end if
> if lcase(.range("ac1").value) = lcase("Price") then
> msgbox "do A"
> end if
> end with
>
> or maybe you meant to check both headers and if either is ok, then do A???
>
> With worksheets("somesheetnamehere")
> if lcase(.range("j1").value) = lcase("Product_Name") _
> or lcase(.range("ac1").value) = lcase("Price") then
> msgbox "do A"
> end if
> end with
>
> or maybe you meant to check both headers and if both are ok, then do A???
>
> With worksheets("somesheetnamehere")
> if lcase(.range("j1").value) = lcase("Product_Name") _
> And lcase(.range("ac1").value) = lcase("Price") then
> msgbox "do A"
> end if
> end with
>
>
>
>
> choo wrote:
> >
> > Hi,
> > I would like to verify the value of certain column header. How does the
> > code looks like?
> >
> > eg.
> > check, if column J = "Product_Name", do A, else stop.
> > if column AC = "Price", do A, else stop.
> >
> > Thank you.
> >
> > choo
>
> --
>
> Dave Peterson
> .
>