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

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.

--
Rick (MVP - Excel)


"Have_Data_Will_Travel" wrote
in message ...
I need to pull certain columns out of a data file to use in the creation of
an invoice. The file is a database export and the database will only pull
user-defined fields if they have data entered in them. Since we can use
the
UDF fields some weeks and not others the data size is variable both in
number
of row and in the columns that are created. I need to be able to select
columns based on their column header (Customer Number, Customer Name, Part
Number, etc).

Is there VBA language that will allow me to select a variable range based
on
the column header?