Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
636to640
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
636to640
636to640
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

If "Dateiname Teilstring" then

If "Dateiname Teilstring" then
19.07.2005 13:54:27
Martin
Hallo Zusammen
wie kriege ich die folgende Prüfung hin?
Nur ausführen wenn der Dateiname den Text "Vorlage Meldeblatt Event-Aktionen" enthält also alle Versionen ebenfalls erlauben zB.
"Vorlage Meldeblatt Event-Aktionen1"

Sub Dateiname enthält ()
'Diese Prüfung kriege ich nicht hin.
If ThisWorkbook.Name = Finden("Vorlage Meldeblatt Event-Aktionen") Then
Application.EnableEvents = False
' Jahr
Cells(3, 21).Value = Cells(3, 32).Value
' Woche
Cells(4, 21).Value = Cells(4, 32).Value
Cells(4, 23).Value = Cells(4, 34).Value
' Zeitraum
Cells(5, 21).Value = Cells(5, 32).Value
Cells(5, 23).Value = Cells(5, 34).Value
' Erst- Letztlieferung
Cells(6, 21).Value = Cells(6, 32).Value
' Felder mit "=" zurücksetzen
Formel = "=rc[-11]"
Cells(3, 32).Select
ActiveCell.FormulaR1C1 = Formel
Cells(4, 32).Select
ActiveCell.FormulaR1C1 = Formel
Cells(4, 34).Select
ActiveCell.FormulaR1C1 = Formel
Cells(5, 32).Select
ActiveCell.FormulaR1C1 = Formel
Cells(4, 34).Select
ActiveCell.FormulaR1C1 = Formel
Cells(6, 32).Select
ActiveCell.FormulaR1C1 = Formel
ActiveSheet.Calculate
Application.EnableEvents = True
MsgBox ("Zeiten umgestellt")
End If
End Sub

Danke für die Hilfe

3
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: If "Dateiname Teilstring" then
19.07.2005 13:59:41
Ralf
Hi Martin,
es ist viel einfacher:
dim x%
for x = 1 to 10 'bis zu 10 Blätter mit diesem namen...
If ThisWorkbook.Name = "Vorlage Meldeblatt Event-Aktionen" & x Then
' Dein Code
End If
Next x
Ciao, Ralf
AW: If "Dateiname Teilstring" then
19.07.2005 14:04:33
Martin
Besten Dank
wie Dumm auch von mir, dass ich darauf nicht gekommen bin?
Nochmals Danke
Mit frundlichen Grüssen
Martin
AW: If "Dateiname Teilstring" then
19.07.2005 16:17:17
Martin
Hallo Ralf
Danke für Deine Hilfe
Habe den Code so eingebaut und es funktioniert bestens.
Angepasst habe ich noch dass wenn die Prüfung positiv ausfällt, der Zähler für x auf 10 gesetzt wird.

Sub ZeitverschiebungOK()
Dim Formel
Dim x%
Dim Kennwort, KWort
Dim User1, User2, AktiveUser
User1 = "MKF20"
User2 = "MPC20"
AktiveUser = Environ("USERNAME")
For x = 1 To 10
If ThisWorkbook.Name <> "Vorlage Meldeblatt Event-Aktionen" & x Then
Kennwort = "planning"
Else
Kennwort = "original"
x = 10
End If
Next x
If Kennwort = "planning" Then
If AktiveUser = User1 Or AktiveUser = User2 Then
KWort = InputBox("VB-SCRIPT PROGRAMMING:" & Chr(10) & "planning" & Chr(10) & Chr(10) & "Geben Sie bitte das" & Chr(10) & "Kennwort für den Start ein!")
If KWort <> Kennwort Then
MsgBox "SORRY" & Chr(10) & "Sie haben ein falsches Kennwort eingegeben"
End
End If
Else
MsgBox "Sie haben keine Berechtigung diese Funktion aufzurufen!"
End
End If
End If
Application.EnableEvents = False
' Jahr
Cells(3, 21).Value = Cells(3, 32).Value
' Woche
Cells(4, 21).Value = Cells(4, 32).Value
Cells(4, 23).Value = Cells(4, 34).Value
' Zeitraum
Cells(5, 21).Value = Cells(5, 32).Value
Cells(5, 23).Value = Cells(5, 34).Value
' Erst- Letztlieferung
Cells(6, 21).Value = Cells(6, 32).Value
' Felder mit "=" zurücksetzen
Formel = "=rc[-11]"
Cells(3, 32).Select
ActiveCell.FormulaR1C1 = Formel
Cells(4, 32).Select
ActiveCell.FormulaR1C1 = Formel
Cells(4, 34).Select
ActiveCell.FormulaR1C1 = Formel
Cells(5, 32).Select
ActiveCell.FormulaR1C1 = Formel
Cells(4, 34).Select
ActiveCell.FormulaR1C1 = Formel
Cells(6, 32).Select
ActiveCell.FormulaR1C1 = Formel
ActiveSheet.Calculate
Application.EnableEvents = True
MsgBox ("Zeiten umgestellt")
End Sub

Gruss
Martin
Anzeige

300 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige