Thread: array sintax
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
NickH NickH is offline
external usenet poster
 
Posts: 60
Default array sintax

Hi Paulo,

Yes the array method is probably faster than a loop but without
knowing exactly what you're trying to do (I can see you are
propogating headers but I can't deduce you're workbook structure from
the code) I wouldn't like to suggest which is the best way to go. If
speed is an issue the following should do pretty much the same as the
routine you posted above but without selecting anything or activating
any sheets, which is rarely necessary...

Sub TopCaption2()
Dim x As Long
Const StartingSheet As Long = 1

For x = StartingSheet To Worksheets.Count
With Worksheets(x)
If .Range("A4").Value = "Nš" Then
If x = 1 Then
x = 2
End If
Else
.Rows(1).Insert Shift:=xlDown
End If
End With

Sheets(" DB ").Select
Rows("1:6").Copy
Next x

Application.CutCopyMode = False
End Sub


HTH NickH