Tuesday 15 September 2015

excel - How to do a row count in VBA to see if I need to pull down a calculation? -


I'm new to VBA in Excel, just like I find ... Now I'm looking at the macro to calculate Some problems with when return data is returned to only one line (this is due to populating all the proceeding rows to an N / A or # REF because the calculation is being dragged)

Special appearance What am I seeing from to determine whether the calculation is brought down Land or not.

Currently, the code reads as follows:

  range ("I7"). Select the Active range ("I7" Select range (select, select end. (XLDown)). Select ActiveSheet.Paste   

What do I need to do that is that one row in less than 1 line

Am I reaching it correctly? Is there any easy way?

I do not think That you need a line number I think you should only have a formula applied to all the cells in column 1, which starts from 7 in the row, in the last populated row. In my example I have the last line in column H

Here you do how: addFormulaToColumn () worksheet dim RNG range as the diminished endline long set wb = This work A Set ws = wb.Sheets ( "Sheet1") lastRow = Range ( "H" and. Rows.Count). End (xlUp). Set rng = ws ("I7: I" and last row) RNG. Formula = "= (RC [-2] = 0,0, (RC [-1] / RC [-2]) * 10000)" End sub

You want to work with it, you can modify it by changing its definition, and if the last line is in any column other than "H", then modify it too.

No comments:

Post a Comment