Looping through individual cells in a range can be slow. It is better to read the range directly into an array, modify the array, and write it back out:
vb Code:
Sub RangeMod() Dim nrow As Integer, ncol As Integer, i As Integer, j As Integer Dim mf As Double Dim a As Variant mf = 1.15 nrow = 27 ncol = 8 a = Range("D5").Resize(nrow, ncol) 'read range into array For i = 1 To nrow 'loop through array For j = 1 To ncol 'loop through array a(i, j) = mf * a(i, j) 'modify array elements Next j Next i Range("D5").Resize(nrow, ncol) = a 'write array back to range End Sub





Reply With Quote