View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ralph Howarth Ralph Howarth is offline
external usenet poster
 
Posts: 1
Default Syntax for Accepting Worksheet Formulas in VB

Hello,

I was looking for a way to have a custom user setup of formulas read by a
standard VB code so the code can adjust to assigning values per formula
entered.

The process involves three worksheets:

Setup
Data
Results

For every column in Results I will have a corresponding formula in Setup.
In Setup, I will have a row to enter in the formulas that all reference the
Data worksheet cells.

In VBA, I will use a For Next loop for reading in formulas, and then nest
that into another For Next loop that runs the count of rows.

If I understand VB syntax correctly my psuedo code would look like this
(assuming that I already have the means to assign the count of rows further
up the code):

For row of Rows as i
For formula of Formulas as j
Data(i,j).formula=Setup(r,j).formula
Results(i,j).value=Evaluate(Data(i,j))
Next
Next

I will have a clear worksheet command at the top for the Results worksheet
and assign the code to a macro button. Upon clicking the macro button the
code will clear the worksheet of old data, read the number of rows of the new
Data as Rows, , do the same for columns for the number of fomrulas, and BAM
run the For Next loops to lay down converted data.

Does this sound like a good plan? This is my first real VB code from
scratch (I have been tweaking provided Macros for years and its time I grow
up!)

Thanks.