So The best way I could think of to accomplish this over a large range (about 450k rows) was to use the following Sue-do code:
Range(\"A1\").Copy \' A1 Cont
Sub Test()
Dim rngData As Range
Set rngData = ThisWorkbook.Worksheets("Sheet1").Range("A1:B10")
rngData = Evaluate(rngData.Address & "*2")
End Sub
Kind of outdated but is that what you were looking for ?
Do not update cell by cell. It is very slow and there is a better way with VBA. Here is the outline:
Here is an example:
Public Sub FactorRange(ByRef r_first as Range, ByVal N_rows as Long, _
ByVal N_cols as Long, ByVal factor as Double)
Dim r as Range
'Set range from first cell and size
Set r = f_first.Resize(N_rows,N_cols)
Dim vals() as Variant
' Copy cell values into array
vals = r.Value
Dim i as Long, j as Long
' Do the math
For i=1 to N_rows
For j=1 to N_cols
vals(i,j) = factor * vals(i,j)
Next j
Next i
' Write values back
r.Value = vals
End Sub
return_sheet = ActiveSheet.Name
ActiveWorkbook.Sheets.Add
ActiveSheet.Name = "CopyPaste"
Selection.Value = 1
Selection.Copy
Sheets(return_sheet).Select 'if necessary select range you whant to multiply
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Application.DisplayAlerts = False
Sheets("CopyPaste").Delete
Application.DisplayAlerts = True
Sheets(return_sheet).Select