B
boblinda11
Need help with a macro I can not for some reason get to work what I am
trying to do is copy cells "AF78:AJ78" and then do a copy, paste
special to "AF81:AJ81" and
then calculate "rand() " and copy "AF78:AJ78" again and then paste
special
to column AF82:AJ82 and then repeat the same procedure 10, 50, 200
times if
wanted. I have no problem editing the macro for the number of times I
want to calculate, copy and paste.
Thanks in Advance
Sub afpaste()
Dim rng As Range, i As Long, j As
Dim cell As Range, n As Long, v(1 To 5) As String
Dim s As Long
s = Applicaton.Calculation
Application.Calculation = xlManual
n = 25
Set rng = Range("AF78:AJ78")
v(1) = "AF": v(2) = "AG": v(3) = "AH"
v(4) = "AI": v(5) = "AJ"
For i = 1 To n
Application.Calculate
j = 0
For Each cell In rng
j = j + 1
Cells(i, v(j)).Value = cell.Value
Next
Next
Application.Calculate = s
End Sub
trying to do is copy cells "AF78:AJ78" and then do a copy, paste
special to "AF81:AJ81" and
then calculate "rand() " and copy "AF78:AJ78" again and then paste
special
to column AF82:AJ82 and then repeat the same procedure 10, 50, 200
times if
wanted. I have no problem editing the macro for the number of times I
want to calculate, copy and paste.
Thanks in Advance
Sub afpaste()
Dim rng As Range, i As Long, j As
Dim cell As Range, n As Long, v(1 To 5) As String
Dim s As Long
s = Applicaton.Calculation
Application.Calculation = xlManual
n = 25
Set rng = Range("AF78:AJ78")
v(1) = "AF": v(2) = "AG": v(3) = "AH"
v(4) = "AI": v(5) = "AJ"
For i = 1 To n
Application.Calculate
j = 0
For Each cell In rng
j = j + 1
Cells(i, v(j)).Value = cell.Value
Next
Next
Application.Calculate = s
End Sub