Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.excel.programming > #109158

Re: Get data for matching headers thru macro

From GS <gs@v.invalid>
Newsgroups microsoft.public.excel.programming
Subject Re: Get data for matching headers thru macro
Date 2016-08-04 15:07 -0400
Organization A noiseless patient Spider
Message-ID <no03pp$6hp$1@dont-email.me> (permalink)
References <2a99142f-1e3f-4615-b821-316c2f8ffecb@googlegroups.com>

Show all headers | View raw


Perhaps a different approach would be a better way to go! You can use 
ADODB to read/write closed workbooks, and work with data fieldnames you 
define. So if your data is structured (all cols hold same data type in 
same order) you can access any field using a pre-defined set of header 
(field) names stored in an Enum. This permits your code to always ref 
the correct field (column) regardless of what label it has.

The same can be done using an array to hold the data. The purpose for 
the enum is to ref the column position for the desired data...

  Sample fields (headers):
  FirstName | Lastname | Initials | Address1 | Address2 | Prov/State |
  ZipCode | M/F | Phone1 | Phone2 | Email

..where loading these and their underlying data into a recordset (ADO) 
or array (VBA) is a 1-step process, but the latter requires the source 
file is open in Excel.

In the case where your fields don't align or have same names, the usual 
approach is to 'Map' fieldnames so you can cross-ref to the correct 
data.

Might seem like a lot of work but once done it results a reusable 
utility. Given the volume of files and any amount of frequency 
processing them, it would certain maximize your productivity.

You can download an Excel ADODB tutorial and working examples here:

  http://www.appspro.com/conference/DatabaseProgramming.zip

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

Back to microsoft.public.excel.programming | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Get data for matching headers thru macro iamankolekar@gmail.com - 2016-08-04 01:44 -0700
  Re: Get data for matching headers thru macro GS <gs@v.invalid> - 2016-08-04 15:07 -0400
    Re: Get data for matching headers thru macro iamankolekar@gmail.com - 2016-08-05 06:43 -0700
      Re: Get data for matching headers thru macro GS <gs@v.invalid> - 2016-08-05 15:15 -0400

csiph-web