View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sam Wilson Sam Wilson is offline
external usenet poster
 
Posts: 523
Default The long way round seems faster...

Hi all,

Any ideas why this:

sub demo()

application.calculation = xlcalculationmanual
range("B2:U201").formula = "=$A2&B$1"

end sub

would be so much slower than this:

sub demo()

application.calculation = xlcalculationmanual

dim i as integer
dim j as integer

for i = 1 to 200
for j = 1 to 20
range("A1").offset(i,j).formula = "=" &
range("a1").offset(i,0).address(false,true) & "&" &
range("a1").offset(0,j).address(true,false)
next j
next i

end sub

The actual formula in my code is more complex than =$A1&B$2, but the
principle is the same.

Sam