PC Review


Reply
Thread Tools Rate Thread

Check column header value

 
 
choo
Guest
Posts: n/a
 
      5th Mar 2010
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
 
Reply With Quote
 
 
 
 
choo
Guest
Posts: n/a
 
      5th Mar 2010
Just want add that they are all on row 1.

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      5th Mar 2010
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
 
Reply With Quote
 
choo
Guest
Posts: n/a
 
      7th Mar 2010
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
> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tabular Report that looks up row header and column header for query parameters Green Biro Microsoft Access Reports 1 9th Feb 2011 07:09 AM
Lookup Values, etracting Row header and column header. visgenesis@gmail.com Microsoft Excel Discussion 1 15th Jul 2008 01:06 AM
How To: Check Box in Datagrid Column Header PD Microsoft Dot NET Framework Forms 0 2nd May 2007 08:33 AM
Search for a column based on the column header and then past data from it to another column in another workbook minkokiss Microsoft Excel Programming 2 5th Apr 2007 01:12 AM
how to set up group header as column header in a report? =?Utf-8?B?bGl6emll?= Microsoft Access Reports 1 14th Sep 2005 01:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:48 PM.