Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1072to1076
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
Inhaltsverzeichnis

Frage

Frage
05.05.2009 11:17:09
sandra
hallo Zusammen ,
ich habe folgendne Code erstellt der beim klicken auf einen button das makro auslöst innerhalb des blattes .,.ich möchte aber das es das für alle weiteren. von mir festgelegten Tabellenblätter übergreifend auch tut..wwas muss ich da tun ?

Private Sub CommandButton1_Click()
For Each blatt In Worksheets
Range("A1").Select
ActiveCell.FormulaR1C1 = "Projekt:"
Range("A3").Select
ActiveCell.FormulaR1C1 = "Mitarbeiter:"
Range("A4").Select
ActiveCell.FormulaR1C1 = "Schicht 1"
Range("A5").Select
ActiveCell.FormulaR1C1 = "Schicht 2"
Range("A6").Select
ActiveCell.FormulaR1C1 = "Schicht 3"
Range("B3:C3").Select
ActiveCell.FormulaR1C1 = "Name:"
Range("D3:E3").Select
ActiveCell.FormulaR1C1 = "Name:"
Range("F3").Select
ActiveCell.FormulaR1C1 = "Produktionstag:"
Range("F4").Select
ActiveCell.FormulaR1C1 = "Betriebsstunden:"
Range("I4").Select
ActiveCell.FormulaR1C1 = "h"
Range("G5").Select
ActiveCell.FormulaR1C1 = ""
Range("F5").Select
ActiveCell.FormulaR1C1 = "Packungsausbringung:"
Range("A7:B7").Select
ActiveCell.FormulaR1C1 = "Produktion"
Range("A8").Select
ActiveCell.FormulaR1C1 = "Start"
Range("B8").Select
ActiveCell.FormulaR1C1 = "Stopp"
Range("C7:D7").Select
ActiveCell.FormulaR1C1 = "Zeiterfassung"
Range("C8").Select
ActiveCell.FormulaR1C1 = "Produktion"
Range("D8").Select
ActiveCell.FormulaR1C1 = "Stillstand"
Range("E7:E8").Select
ActiveCell.FormulaR1C1 = "Fehler" & Chr(10) & "Code"
With ActiveCell.Characters(Start:=1, Length:=11).Font
.Name = "Arial"
.FontStyle = "Fett"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
Range("F7:F8").Select
ActiveCell.FormulaR1C1 = "Bau-gruppe"
With ActiveCell.Characters(Start:=1, Length:=10).Font
.Name = "Arial"
.FontStyle = "Fett"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
Range("G7:G8").Select
ActiveCell.FormulaR1C1 = "Packungszähler"
With ActiveCell.Characters(Start:=1, Length:=14).Font
.Name = "Arial"
.FontStyle = "Fett"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
Range("H7:H8").Select
ActiveCell.FormulaR1C1 = "Verlust Packung"
With ActiveCell.Characters(Start:=1, Length:=15).Font
.Name = "Arial"
.FontStyle = "Fett"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
Range("I7").Select
ActiveCell.FormulaR1C1 = "Beschreibung Störung"
Range("J7:J8").Select
ActiveCell.FormulaR1C1 = "Montageaufwendungen"
With ActiveCell.Characters(Start:=1, Length:=19).Font
.Name = "Arial"
.FontStyle = "Fett"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
Range("K7").Select
ActiveCell.FormulaR1C1 = "ausgetauschtes Bauteil"
Range("K8").Select
ActiveWindow.SmallScroll Down:=33
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
Range("A76").Select
ActiveCell.FormulaR1C1 = "Summe Zeit:"
Range("A77").Select
ActiveCell.FormulaR1C1 = "Summe Stillstand technisch:"
Range("A78").Select
ActiveCell.FormulaR1C1 = "Summe Stillstand organisatorisch:"
Range("A79").Select
ActiveCell.FormulaR1C1 = "Summe Rüstzeit:"
Range("E76").Select
ActiveCell.FormulaR1C1 = "Packungen prod.:"
Range("F77").Select
ActiveCell.FormulaR1C1 = ""
Range("E77").Select
ActiveCell.FormulaR1C1 = "Verlust Packungen: "
Range("E78").Select
ActiveCell.FormulaR1C1 = "Verlustanteil: "
Range("E79").Select
ActiveCell.FormulaR1C1 = "Summe Rollenwechsel:"
Range("I76").Select
ActiveCell.FormulaR1C1 = "Technischer Wirkungsgrad:"
Range("I77").Select
ActiveCell.FormulaR1C1 = "Mittlere Ausbringung [Pckg/h] / in %:"
Range("I78").Select
ActiveCell.FormulaR1C1 = "Betriebszeit:"
Range("A82:K85").Select
ActiveCell.FormulaR1C1 = "Kommentar:"
With ActiveCell.Characters(Start:=1, Length:=10).Font
.Name = "Arial"
.FontStyle = "Fett"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("A82:K85").Select
ActiveCell.FormulaR1C1 = "Kommentar:"
With ActiveCell.Characters(Start:=1, Length:=10).Font
.Name = "Arial"
.FontStyle = "Fett"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("I89").Select
Next blatt
End Sub


17
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Frage
05.05.2009 11:27:05
Tino
Hallo,
räume mal Deinen Code auf.
Mach es so.
Vorher:

Private Sub CommandButton1_Click()
For Each blatt In Worksheets
Range("A1").Select
ActiveCell.FormulaR1C1 = "Projekt:"
Range("A3").Select
ActiveCell.FormulaR1C1 = "Mitarbeiter:"
Range("A4").Select
usw…


Nachher:


Private Sub CommandButton1_Click()
For Each blatt In Worksheets
blatt.Range("A1").FormulaR1C1 = "Projekt:"
blatt.Range("A3").FormulaR1C1 = "Mitarbeiter:"
usw…


Gruß Tino

AW: Frage
05.05.2009 11:30:17
Hajo_Zi
Hallo Sandra,

Option Explicit
Private Sub CommandButton1_Click()
Dim Blatt As Worksheet
For Each Blatt In Worksheets
With Blatt
.Range("A1") = "Projekt:"
.Range("A3") = "Mitarbeiter:"
.Range("A4") = "Schicht 1"
.Range("A5") = "Schicht 2"
.Range("A6") = "Schicht 3"
.Range("B3:C3") = "Name:"
.Range("D3:E3") = "Name:"
.Range("F3") = "Produktionstag:"
.Range("F4") = "Betriebsstunden:"
.Range("I4") = "h"
.Range("G5") = ""
.Range("F5") = "Packungsausbringung:"
.Range("A7:B7") = "Produktion"
.Range("A8") = "Start"
.Range("B8") = "Stopp"
.Range("C7:D7") = "Zeiterfassung"
.Range("C8") = "Produktion"
.Range("D8") = "Stillstand"
With .Range("E7:E8")
.Value = "Fehler" & Chr(10) & "Code"
With .Characters(Start:=1, Length:=11).Font
.Name = "Arial"
.FontStyle = "Fett"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
End With
With .Range("F7:F8")
.Value = "Bau-gruppe"
With .Characters(Start:=1, Length:=10).Font
.Name = "Arial"
.FontStyle = "Fett"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
End With
With .Range("G7:G8")
.Value = "Packungszähler"
With .Characters(Start:=1, Length:=14).Font
.Name = "Arial"
.FontStyle = "Fett"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
End With
With .Range("H7:H8")
.Value = "Verlust Packung"
With .Characters(Start:=1, Length:=15).Font
.Name = "Arial"
.FontStyle = "Fett"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
End With
.Range("I7") = "Beschreibung Störung"
With .Range("J7:J8")
.Value = "Montageaufwendungen"
With .Characters(Start:=1, Length:=19).Font
.Name = "Arial"
.FontStyle = "Fett"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
End With
.Range("K7") = "ausgetauschtes Bauteil"
.Range("A76") = "Summe Zeit:"
.Range("A77") = "Summe Stillstand technisch:"
.Range("A78") = "Summe Stillstand organisatorisch:"
.Range("A79") = "Summe Rüstzeit:"
.Range("E76") = "Packungen prod.:"
.Range("F77") = ""
.Range("E77") = "Verlust Packungen: "
.Range("E78") = "Verlustanteil: "
.Range("E79") = "Summe Rollenwechsel:"
.Range("I76") = "Technischer Wirkungsgrad:"
.Range("I77") = "Mittlere Ausbringung [Pckg/h] / in %:"
.Range("I78") = "Betriebszeit:"
With .Range("A82:K85")
.Value = "Kommentar:"
With .Characters(Start:=1, Length:=10).Font
.Name = "Arial"
.FontStyle = "Fett"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
End With
With .Range("A82:K85")
.Value = "Kommentar:"
With .Characters(Start:=1, Length:=10).Font
.Name = "Arial"
.FontStyle = "Fett"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
End With
End With
Next Blatt
End Sub



Anzeige
AW: Frage
05.05.2009 11:41:11
sandra
danke werde beides ausprobieren ..aber das zweite von hajo hat leider nicht ganz funktioniert..muss jetzt nochmal nahcdenken...aber dder vorteil ist das es dann ohne makro funktioert...gibt es denn noch ne möglichkeit es nciht auf alle tabellenbläter in einer mappe zu bzeiehen ?
AW: Frage
05.05.2009 11:54:48
sandra
ah gut ich habe das verstanden..mein problem ist allerdings er soll halt ein tabellenblatt einmal in detusch poder nach bedarf in englisch umandlen ...ich dnek ich muss ihm das dann aber pro blatt sagen, da sich die zellenbereich immer ändern (( hmm doof..falls kjeamnd noch ne idee hat wäre super
AW: Frage
05.05.2009 12:38:47
sandra
noch eine frage mit der bitte um hilfe..kann iuch denn nicht ihm sagen such meine tabelle nach dem wort projekt ab und ersezt es dann durch liebe zb. ?
hierzu eine hilfe das wäre super
Anzeige
Bearbeiten-Ersetzen owT
05.05.2009 12:45:47
D.Saster
AW: Bearbeiten-Ersetzen owT
05.05.2009 12:49:26
sandra
? äh was meinst du?
so mit Replace
05.05.2009 12:55:21
Tino
Hallo,

Sub Beispiel()
Dim mySH As Worksheet
Dim SuchBergriff As String, strErsetzte As String
SuchBergriff = "projekt"
strErsetzte = "liebe"
Application.ReplaceFormat.Clear
For Each mySH In ThisWorkbook.Worksheets
mySH.Cells.Replace SuchBergriff, strErsetzte, xlPart, xlByRows, False, False
Next mySH
End Sub


Gruß Tino

AW: so mit Replace
05.05.2009 13:01:18
sandra
vielen dank damit komm ich glaub ich weiter..nun muss ich das nur noch für einige wörter einrichten und kann dann ne umwanlund von deutsch in englisch machen..danke ich hatte sowas mal früher gemacht aber man vergisst doch echt einiges wie das mal so war...lieben dank!!
Anzeige
AW: so mit Replace
05.05.2009 13:30:13
sandra
nochn eine frage das klappt super !!--aber ich habe ungefähr 50 wörter und nicht das ich mir mehr arbeit mach als geplant.-..bin ich dann so afu dem richtigen wege oder gitb es noch ne vereinfachung dessen ?

Private Sub CommandButton1_Click()
Dim mySH As Worksheet
Dim suchbegriff As String, strersetze As String, suchbegriff1 As String, suchbegriff2 As  _
String, _
_
strersetze1 As String, strersetze2 As String
suchbegriff = "projekt"
suchbegriff1 = "Mitarbeiter"
suchbegriff2 = "Name"
strersetze = "project"
strersetze1 = "employee"
strersetze2 = "name"
Application.ReplaceFormat.Clear
For Each mySH In ThisWorkbook.Worksheets
mySH.Cells.Replace suchbegriff, strersetze, xlPart, xlByRows, False, False
Next mySH
For Each mySH In ThisWorkbook.Worksheets
mySH.Cells.Replace suchbegriff1, strersetze1, xlPart, xlByRows, False, False
Next mySH
For Each mySH In ThisWorkbook.Worksheets
mySH.Cells.Replace suchbegriff2, strersetze2, xlPart, xlByRows, False, False
Next mySH
End Sub

Anzeige
AW: so mit Replace
05.05.2009 15:01:23
D.Saster
Hallo,
ich würde die Wortpaare in ein Blatt schreiben (hier: Suchbegriffe ab A2)

Private Sub CommandButton1_Click()
Dim mySH As Worksheet, i As Integer
Dim arrSuch, arrErsetze
With Sheets("Suchbegriffe")
arrSuch = .Range(.Cells(2, 1), .Cells(2, 1).End(xlDown))
arrErsetze = .Range(.Cells(2, 2), .Cells(2, 2).End(xlDown))
End With
Application.ReplaceFormat.Clear
For i = 1 To UBound(arrSuch)
For Each mySH In ThisWorkbook.Worksheets
mySH.Cells.Replace arrSuch(i), arrErsetze(i), xlPart, xlByRows, False, False
Next mySH
Next i
End Sub


Gruß
Dierk

Anzeige
AW: so mit Replace
06.05.2009 13:04:57
sandra
also mittlerweile klappt alles suoer aber es stellt sich noch die frage ob die möglichkeit besteht ihm zus agen das er nur kopmplette worte verändernt soll..BSP: er soll Bauteil in englisch umwandelnt aber nicht alle wärter wo er bau findet ..? kann mir jemand helfen?
AW: so mit Replace
06.05.2009 23:11:15
Tino
Hallo,
mach aus xlPart -&gt xlWhole
Damit wird der Gesamte Inhalt verglichen.
Gruß Tino
AW: so mit Replace
07.05.2009 07:57:50
sandra
ok das macht er ..hab ich gestern abend alles verändert ...was mach ich aber wenn er in einer zelle stehen hat summe bauteil und er soll das veränmdern ?
AW: so mit Replace
07.05.2009 08:11:53
Tino
Hallo,
verstehe jetzt nicht, gib doch z. Bsp. als
Suchbegriff "summe bauteil" an und ersetzen durch "total component"
Gruß Tino
Anzeige
AW: so mit Replace
07.05.2009 08:58:34
sandra
ja es funktuioniert...danke war nicht ganz wach.-)))!!!!
Strg+H
05.05.2009 13:02:43
Matthias
Hallo
Userbild

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige