View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Have_Data_Will_Travel Have_Data_Will_Travel is offline
external usenet poster
 
Posts: 7
Default Editing While Using Column Headers As A Reference

Ahhh...I see. So I'm defining the variable so that I can use it in a code to
define the range that I want to copy and paste into my template.

"Rick Rothstein" wrote:

From the Column property of the range that the Find function returns. This part...

Rows(1).Find("Part Number", LookIn:=xlValues, LookAt:=xlWhole, MatchCase:=False)

returns the cell in Row 1 containing the text "Part Number" as a range... the .Column I placed after it in my original code pulls out the column number and (again, in my original code) I then assigned this column number to a variable which I named ColNumber for my example. You can assign it to any variable you want, or use it for the column argument in a Cells property call, or use it as the argument to a MsgBox statement, etc., etc.

--
Rick (MVP - Excel)


I'm not sure I understand. Where do I actually "get" the column number with
this code? Do I need to make it part of a message box or something?

What I want to do is to have a template with the headers I'm looking for and
search the raw data for the data under those columns. I could probably do it
with hlookups but it would take thousands of them.

"Rick Rothstein" wrote:

You can get the column number of a given column header like this...

ColNumber = Rows(1).Find("Part Number", LookIn:=xlValues, _
LookAt:=xlWhole, MatchCase:=False).Column

where I assumed Row 1 contained the headers and, for the above example, that
we were looking for the Part Number header. You can use the found column
number in a Cells property call for a given row number to specify the
contents of that particular cell.


.