0

Good afternoon,

I'm looking to create a macro, that fills out a table X, whilst calculating equations using values from another table Y, that change every time a column in table X is finished and the previous column in table X.

So I've defined all the values from table Y (Dim Num... As Integers) and start off by defining the values from table x, then move to the right cell and complete the equations for that column. Could I then just go ahead and do something like this to define Values from table X and have it repeat time over time until it fills out the table?

ActiveCell.Offset(0, -1).Select
N1 = ActiveCell.Value
ActiveCell.Offset(1, 0).Select
N2 = ActiveCell.Value
ActiveCell.Offset(1, 0).Select
N3 = ActiveCell.Value
ActiveCell.Offset(1, 0).Select
N4 = ActiveCell.Value
ActiveCell.Offset(1, 0).Select
N5 = ActiveCell.Value
ActiveCell.Offset(1, 0).Select
N6 = ActiveCell.Value
ActiveCell.Offset(-5, 1).Select

To basically redefine N1-6 as we go through to the next column.

The Calculations are then just done as follows:

ActiveCell.Value = N3 - (N3 * Num12)
ActiveCell.Offset(1, 0).Select

Thanks for any help or advice

BigBen
  • 46,229
  • 7
  • 24
  • 40
conoR-
  • 1
  • [Using `Select` is bad practice and can almost always be avoided](https://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba). Can you show some sample data and the desired output? – jsheeran Apr 06 '22 at 15:39
  • I have values X1-X20 that change slightly once the column of the table is completed and become new numbers after that as well as Y1-Y6 in column 1 of the table. The goal is to have this table fill it's self out by first of all going Y1*X1=ActiveCell (Z1), then Y2 * X2=Activecell (Z2), etc. until you get to Y6*X6=ActiveCell (Z6). Then you skip to the next column of the table to which you now have new X values in the same cells and instead of Y you are looking to use the values you just calculated in Z, i.e.: X1*Z1=Activecell (AA1), X2*Z2=ActiveCell(AA2), and so on and so forth – conoR- Apr 07 '22 at 08:26

0 Answers0