Hi,
I have an excel worksheet which has 30-35 pages/page breaks. There are in all 4 sections spread across these pages. what i want to do here is insert a particular shape ("water_1") on only two of sections from the page section starts and ends. Below is the array code followed by loop which will be constant every time, but i am not able to run that on specific pages using array
Sub headers()
Dim pgname() As String
ReDim pgname(1 To 4) As String
pgname(1) = "Market Background"
pgname(2) = "Assets"
pgname(3) = "Glossary"
pgname(4) = "Let's Talk"
For i = 1 To 4
Call waterPosition
Next i
End Sub
Sub waterPosition()
Dim sh As Shape
Dim tsh As Shape
pgnum = 4
Set sh = ActiveSheet.Shapes("Water_1")
sh.Left = 20
sh.Top = (pgnum - 1) * 1300 + 600
sh.Rotation = -45
i = 2
pgnum = pgnum + 1
Do while pgnum<=10
Set tsh = sh.Duplicate
tsh.Name = "Water_" & i
tsh.Left = 20
tsh.Top = (pgnum - 1) * 1300 + 600
i = i + 1
pgnum = pgnum + 1
loop
End Sub
I have an excel worksheet which has 30-35 pages/page breaks. There are in all 4 sections spread across these pages. what i want to do here is insert a particular shape ("water_1") on only two of sections from the page section starts and ends. Below is the array code followed by loop which will be constant every time, but i am not able to run that on specific pages using array
Sub headers()
Dim pgname() As String
ReDim pgname(1 To 4) As String
pgname(1) = "Market Background"
pgname(2) = "Assets"
pgname(3) = "Glossary"
pgname(4) = "Let's Talk"
For i = 1 To 4
Call waterPosition
Next i
End Sub
Sub waterPosition()
Dim sh As Shape
Dim tsh As Shape
pgnum = 4
Set sh = ActiveSheet.Shapes("Water_1")
sh.Left = 20
sh.Top = (pgnum - 1) * 1300 + 600
sh.Rotation = -45
i = 2
pgnum = pgnum + 1
Do while pgnum<=10
Set tsh = sh.Duplicate
tsh.Name = "Water_" & i
tsh.Left = 20
tsh.Top = (pgnum - 1) * 1300 + 600
i = i + 1
pgnum = pgnum + 1
loop
End Sub