Schleifenbedingung
14.07.2003 19:29:02
Torsten
ich hab ein kleines weiteres problem.
Hab es endlich geschafft das mir excel automastich bilder in meinem sheets generiert und das per schaltfläche. war ein template von hier :)
Nur macht er das für ALLE Blätter.
ich möchte nun per bedingung ein Blatt freilassen.
Er soll z.b. die schleife für alle Tabellenblätter ausführen nur nihct für das tabellenblatt "gesamt"
hier mein code (ist sicher auch für andere brauchbar)
-------------------------------------------------
Sub Worksheets_Bilder_Change()
Dim aPic As Picture
Dim bPic As Picture
Dim cPic As Picture
Dim dPic As Picture
Dim iWks As Integer
Dim aFile As String
Dim bFile As String
Dim cFile As String
Dim dFile As String
Dim wb As Workbook
Dim ws As Worksheet
Set wb = ActiveWorkbook
iWs = 2
aFile = "d:\briefpapier_kopf.jpg"
bFile = "d:\briefpapier_boden.jpg"
cFile = "d:\falzmarke.gif"
dFile = "d:\unterschrift.jpg"
For Each ws In wb.Worksheets
ws.Pictures.Delete 'löscht vorher die bilder
For iWs = ws.Index To Worksheets.Count
Set aPic = Worksheets(iWs).Pictures.Insert(aFile)
With aPic
.Left = 0
.Top = 0
.Width = 525
.Height = 130
.OnAction = "worksheets_zurück_zu_gesamt"
End With
Set bPic = Worksheets(iWs).Pictures.Insert(bFile)
With bPic
.Left = 0
.Top = 760
.Width = 525
.Height = 35
.OnAction = "worksheets_zurück_zu_gesamt"
End With
Set cPic = Worksheets(iWs).Pictures.Insert(cFile)
With cPic
.Left = 0
.Top = 0
.Width = 5
.Height = 800
.OnAction = "worksheets_zurück_zu_gesamt"
End With
Set dPic = Worksheets(iWs).Pictures.Insert(dFile)
With dPic
.Left = 45
.Top = 580
.Width = 200
.Height = 50
.OnAction = "worksheets_zurück_zu_gesamt"
End With
Next iWs
Next ws
Errorhandler:
End Sub
------------------------------------------------
Sub worksheets_zurück_zu_gesamt()
zurueck = "Gesamt"
Worksheets(zurueck).Select
End Sub
------------------------------------------
ich kriegs einfach nihct hin da noch eine bedingung einzubauen.
danke euch schonmal im voraus
Grüsse Torsten