I need help with do until loop. In one sheet "overview", I have the formulas in certain ranges for more countries. Every country has it 3 times (costs) and every time I need to move (offset) by 9 columns to copy and paste into other sheet "Overview_values") in the same range.
Below is the code I have tried. Overview is the sheet of the formulas, in overview_v I would like to paste the same results as numbers. Num 48 means that I have 16 countries and for each country I have to do it 3 times. comp_of_costs_overview range is the starting range from overview with formulas comp_of_costs_overview_v range is the demanding range where I would like to paste as values I need to offset this by 9 columns till the last country, but when I run this code every time I fill only the range comp_of_costs_overview_v without any offset (the other countries are not filled with values).
Dim comp_of_costs_overview As Range
Dim comp_of_costs_overview_v As Range
Dim posun_stlpec As Range
Dim num As Integer
num = 48
Do
num = num - 3
Set posun_stlpec = Range("U25:U30")
Worksheets("Overview").Activate
Set comp_of_costs_overview = Range("L25:L30")
Worksheets("Overview_values").Activate
Set comp_of_costs_overview_v = Range("L25:L30")
Worksheets("Overview").Activate
comp_of_costs_overview.Select
Selection.Copy
Worksheets("Overview_values").Activate
comp_of_costs_overview_v.Select
Selection.PasteSpecial Paste:=xlPasteValues
Set posun_stlpec = Range("U25:U30")
Loop Until num = 0
I Have no error during the code, just does not work how I would like to see