View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Nestling of functions

Does this work for you?

Sheets("Parametrar").Range("b40:e77").Copy
ActiveSheet.Unprotect Password:="tomstr"
For Each sh In ActiveWorkbook.Worksheets
If sh.Name < "Parametrar" Then
sh.Unprotect Password:="tomstr"
Sheets("Parametrar").Range("b40:e77").Copy _
sh.Range("A1")
sh.Protect Password:="tomstr"
End If
Next x
ActiveSheet.Protect Password:="tomstr"


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Tomas Stroem" wrote in message
...
I want to insert a certain number of row texts into 20 identical

spreadsheets.
When I copy the area I want to insert then my macro stops after the first

of
the 20 sheets.
I use "for x=1 to 20" "Next x" to acheive the repeated copy.

Is there a simple way to get the result i want?

20 sheets in one Workbook

The code I have is the following. It solves the problem but on slow

machines
in the organisation it takes time as I make three loops

-----------------------------------------------------------
ActiveSheet.Unprotect Password:="tomstr"

Sheets("Pos A").Select
For x = 1 To 20
ActiveSheet.Unprotect Password:="tomstr"
Range("a31").Select
ActiveSheet.Next.Select
Next x


Sheets("Parametrar").Select
Range("b40:e77").Select
Application.CutCopyMode = False
Selection.Copy

Sheets("Pos A").Select
For x = 1 To 20
ActiveSheet.Paste
ActiveSheet.Next.Select
Next x

Sheets("Pos A").Select
For x = 1 To 20
Range("a12").Select
Range("a2").Select
Range("a1").Select
ActiveSheet.Protect Password:="tomstr"
ActiveSheet.Next.Select
Next x

Sheets("Projektbeskrivning").Select
ActiveSheet.Protect Password:="tomstr"
Range("a12").Select
Range("a2").Select
Range("a1").Select
End Sub
--
Tomas S