So I created a rate calculator that allows the user to enter answers for questions pertaining to the rater ("r_user_interface").
These answers are linked to a table that has various calculations that gives the final result in the cell called ("v_premium")
The problem is, I now want to set default choices in order to compare the rates through all the zip codes, so what I did was create a transposed version of "r_user_interface" called "r_default_choices".
I then created a table which contains all 1106 zip codes as well as headers which pertain to the questions being asked in the user interface.
The macro then copies "r_default_choices" to the range of the table that contains the zip codes.
I now loop through every row in the table with the zip codes and default choices, and paste it in "r_user_interface" to get its respective "v_premium" value and paste it at the end of the row.
It takes around 45 seconds to complete the process, any thoughts on how I can speed things up?
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">Sub cop_paste_values()
Dim rng As Range
Dim user_rng As Range
Dim row As Range
On Error Resume Next
Application.screenupdating=False
Worksheets("Batch rater").Range("r_default_choices").Copy
Worksheets("Batch rater").Range("t_default_choices").PasteSpecial Paste:=xlPasteValues
Set user_rng = Worksheets("User Interface").Range("r_user_interface")
Set rng = Range("t_default_choices_with_zip")
i = 23
While i <= 1106
For Each row In rng.Rows
row.Copy
user_rng.PasteSpecial Paste:=xlPasteValues, Transpose:=True
Worksheets("Batch rater").cells(i, 43).Value = Worksheets("Rater").Range("v_premium").Value
i = i + 1
Next
Wend
application.screenupdating=True
Application.CutCopyMode = False
End Sub</code>
These answers are linked to a table that has various calculations that gives the final result in the cell called ("v_premium")
The problem is, I now want to set default choices in order to compare the rates through all the zip codes, so what I did was create a transposed version of "r_user_interface" called "r_default_choices".
I then created a table which contains all 1106 zip codes as well as headers which pertain to the questions being asked in the user interface.
The macro then copies "r_default_choices" to the range of the table that contains the zip codes.
I now loop through every row in the table with the zip codes and default choices, and paste it in "r_user_interface" to get its respective "v_premium" value and paste it at the end of the row.
It takes around 45 seconds to complete the process, any thoughts on how I can speed things up?
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">Sub cop_paste_values()
Dim rng As Range
Dim user_rng As Range
Dim row As Range
On Error Resume Next
Application.screenupdating=False
Worksheets("Batch rater").Range("r_default_choices").Copy
Worksheets("Batch rater").Range("t_default_choices").PasteSpecial Paste:=xlPasteValues
Set user_rng = Worksheets("User Interface").Range("r_user_interface")
Set rng = Range("t_default_choices_with_zip")
i = 23
While i <= 1106
For Each row In rng.Rows
row.Copy
user_rng.PasteSpecial Paste:=xlPasteValues, Transpose:=True
Worksheets("Batch rater").cells(i, 43).Value = Worksheets("Rater").Range("v_premium").Value
i = i + 1
Next
Wend
application.screenupdating=True
Application.CutCopyMode = False
End Sub</code>