Guanjin Peter
Active Member
- Joined
- May 21, 2008
- Messages
- 429
I'm currently using the below code to add the formula in each cell. Depending on the number of rows.
It's very slow (Range("aa2").Value returns 1060) which means 1k rows. I was thinking of doing copy and paste to speed up. But I do not want to fill the whole column U (Column 13) with the formula. Is there anyway to set the max to copy to?
like r2:rX
where X is Range("aa2").Value?
It's very slow (Range("aa2").Value returns 1060) which means 1k rows. I was thinking of doing copy and paste to speed up. But I do not want to fill the whole column U (Column 13) with the formula. Is there anyway to set the max to copy to?
like r2:rX
where X is Range("aa2").Value?
Code:
Private Sub CommandButton1_Click()
Dim nDb As Integer
intRow = 2
Range("aa2").Value = "=COUNTA(A:A)-1"
nDb = Range("aa2").Value
Do While nDb > intRow
Var = "=IF(RC2=""Positive Adjmt."",+RC13,IF(RC2=""Negative Adjmt."",-RC13,""Invalid""))"
ActiveSheet.Range("u" & intRow).End(xlUp).Offset(1, 0).Resize(, 1) = Var
'Worksheets("nvT").Cells(intRow2, 4).Resize(, cpro).Value = qty
intRow = intRow + 1
Loop 'end of do-while
End Sub
Last edited: