excel - Performance issues when automatically putting a large amount of links in spreadsheet -
i using code snippet place links workbook own:
sub legg_inn_lekkjer() dim long call deaktiver = 0 740 loktider.range("c4").offset(i, 0) = "='[simulering arbeidsplan ovn 3 28h.xls]lokklegging'!r" & cstr(11 + i) & "c6" loktider.range("d4").offset(i, 0) = "='[simulering arbeidsplan ovn 3 28h.xls]lokklegging'!r" & cstr(11 + i) & "c5" loktider.range("e4").offset(i, 0) = "='[simulering arbeidsplan ovn 3 28h.xls]lokklegging'!r" & cstr(11 + i) & "c16" loktider.range("f4").offset(i, 0) = "='[simulering arbeidsplan ovn 3 28h.xls]lokklegging'!r" & cstr(11 + i) & "c15" loktider.range("g4").offset(i, 0) = "='[simulering arbeidsplan ovn 4 30h.xls]lokklegging'!r" & cstr(11 + i) & "c6" loktider.range("h4").offset(i, 0) = "='[simulering arbeidsplan ovn 4 30h.xls]lokklegging'!r" & cstr(11 + i) & "c5" loktider.range("i4").offset(i, 0) = "='[simulering arbeidsplan ovn 4 30h.xls]lokklegging'!r" & cstr(11 + i) & "c16" loktider.range("j4").offset(i, 0) = "='[simulering arbeidsplan ovn 4 30h.xls]lokklegging'!r" & cstr(11 + i) & "c15" next call reaktiver end sub sub deaktiver() application.enableevents = false application.screenupdating = false application.displaystatusbar = false application.calculation = xlcalculationmanual ' activesheet.displaypagebreaks = true 'note sheet-level setting end sub sub reaktiver() application.enableevents = true application.screenupdating = true application.displaystatusbar = true application.calculation = xlcalculationautomatic ' activesheet.displaypagebreaks = true 'note sheet-level setting end sub
it works correctly, takes quite while run. won't problem, won't need update link-addresses often, still wondered if there more efficient way this, using kind of relative reference input addresses each column @ once instance? quite lot of googling indicates "no", figured wouldn't hurt ask.
i can imagine quite slow, loop entering cell values individual in 10 columns 741 iterations, around 7.4k cell entries done individually.
you either create cell values in array , paste array workbook, or more enter expected formulae in top row , fill down appropriate.
as example replace:
= 0 740 loktider.range("c4").offset(i, 0) = "='[simulering arbeidsplan ovn 3 28h.xls]lokklegging'!r" & cstr(11 + i) & "c6" loktider.range("d4").offset(i, 0) = "='[simulering arbeidsplan ovn 3 28h.xls]lokklegging'!r" & cstr(11 + i) & "c5" loktider.range("e4").offset(i, 0) = "='[simulering arbeidsplan ovn 3 28h.xls]lokklegging'!r" & cstr(11 + i) & "c16" loktider.range("f4").offset(i, 0) = "='[simulering arbeidsplan ovn 3 28h.xls]lokklegging'!r" & cstr(11 + i) & "c15" loktider.range("g4").offset(i, 0) = "='[simulering arbeidsplan ovn 4 30h.xls]lokklegging'!r" & cstr(11 + i) & "c6" loktider.range("h4").offset(i, 0) = "='[simulering arbeidsplan ovn 4 30h.xls]lokklegging'!r" & cstr(11 + i) & "c5" loktider.range("i4").offset(i, 0) = "='[simulering arbeidsplan ovn 4 30h.xls]lokklegging'!r" & cstr(11 + i) & "c16" loktider.range("j4").offset(i, 0) = "='[simulering arbeidsplan ovn 4 30h.xls]lokklegging'!r" & cstr(11 + i) & "c15" next
with:
edit -- r1c1 reference system seems use absolute values, standard cell reference added instead
with loktider .range("c4") = "='[simulering arbeidsplan ovn 3 28h.xls]lokklegging'!f11" .range("d4") = "='[simulering arbeidsplan ovn 3 28h.xls]lokklegging'!e11" .range("e4") = "='[simulering arbeidsplan ovn 3 28h.xls]lokklegging'!p11" .range("f4") = "='[simulering arbeidsplan ovn 3 28h.xls]lokklegging'!o11" .range("g4") = "='[simulering arbeidsplan ovn 4 30h.xls]lokklegging'!f11" .range("h4") = "='[simulering arbeidsplan ovn 4 30h.xls]lokklegging'!e11" .range("i4") = "='[simulering arbeidsplan ovn 4 30h.xls]lokklegging'!p11" .range("j4") = "='[simulering arbeidsplan ovn 4 30h.xls]lokklegging'!o11" range(.cells(4,3),.cells(744,10)).filldown end
this on few assumptions, loktider
worksheet
variable you've created, , you'll using specific range hardcoded loop counter.
Comments
Post a Comment