View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
havocdragon havocdragon is offline
external usenet poster
 
Posts: 75
Default I have a challenge for all you VBA experts out there!

Unfortuneatly you cannot copy the column headers out of SAP, or atleast the
sap screen I am using, so only the data is listed

"Myrna Larson" wrote:

I would NOT move the data around.

Assuming you have headers containing Valuation Type, Movements, etc, in your
VBA code you can locate the columns using MATCH

ValCol = Application.Match("Valuation Type"),Sheet1.Rows(1), 0)
MovCol = Application.Match("Movements"),Sheet1.Rows(1), 0)

etc.

Let's say that you have assumed that Movements is in column 6, and you
hard-coded the column number in the line that retrieves that value. Change
your code to

Cells(R, MovCol).Value


On Thu, 16 Sep 2004 12:19:05 -0700, "havocdragon"
wrote:

Ok so I have created this calculator (over the span of a few weeks) which
calculates inventory movements out of a program called SAP. Basically you
copy info out of SAP and paste it to my calculator. And so far the calculator
has saved ALOT of time. I have a few macros on it already, just to append a
few things and clean some stuff up, however the next step I wan't to take I
believe, is beyond my abilities with VBA right now. Heres what I want to do;

not everyone using this calculator has the same columns in SAP as I do,
however there are 3 fields that are used in the calculator, that everyone
does have. these fields are 'Valuation type' 'Movements' and 'Quantities'.
Now in everyones sap these colums can be arranged differently, so what I need
is, a macro that once these items are pasted, to arrange them correcltly,
because I dont think I can write a macro that does all the caclculations on
this sheet! Obviously the columns my formulas are in cannot find where they
need to calculate, it needs to be in a specific space. So anyone know where
to start on that? Let me know if you need more info, which im sure you will

=)