VBA Code optimieren
20.10.2017 15:17:37
Mario
ich habe mir einen VBA Code geschrieben der only Leseberechtigte Excel User bei Dateneintragung "VF" "U" etc auf "AW" ändert, dieses passiert auf 12 Worksheets ( Jänner bis Februar [ 1-12 ]
der Code ist soweit ausführbar aber nicht gerade der schönste
bitte um hilfe wenn möglich möchte ich
- die 12 Worksheets in schleife setzten ( derzeit schreibe ich jede einzeln )
- Selection.Replace möchte ich auch gerne "VF" "U" usw in einer abfrage auf "AW" ändern
hier der derzeitige code:
Sub AlleBlaetterEinblenden()
Application.EnableCancelKey = xlDisabled
Dim sh As Worksheet
ThisWorkbook.Unprotect Password:="mario"
For Each sh In Sheets
sh.Visible = True
Next sh
ThisWorkbook.Protect Password:="mario"
If ActiveWorkbook.ReadOnly Then
Tabelle1.Select
Range("E6..BN39").Select
Selection.Replace What:="VF", Replacement:="AW", LookAt:=xlWhole
Selection.Replace What:="U", Replacement:="AW", LookAt:=xlWhole
Selection.Replace What:="K", Replacement:="AW", LookAt:=xlWhole
Selection.Replace What:="UP", Replacement:="AW", LookAt:=xlWhole
Selection.Replace What:="KK", Replacement:="AW", LookAt:=xlWhole
Selection.Replace What:="FE", Replacement:="AW", LookAt:=xlWhole
Selection.Replace What:="FK", Replacement:="AW", LookAt:=xlWhole
Selection.Replace What:="ZU", Replacement:="AW", LookAt:=xlWhole
Range("E6").Select
Tabelle2.Select
Range("E6..BN39").Select
Selection.Replace What:="VF", Replacement:="AW", LookAt:=xlWhole
Selection.Replace What:="U", Replacement:="AW", LookAt:=xlWhole
Selection.Replace What:="K", Replacement:="AW", LookAt:=xlWhole
Selection.Replace What:="UP", Replacement:="AW", LookAt:=xlWhole
Selection.Replace What:="KK", Replacement:="AW", LookAt:=xlWhole
Selection.Replace What:="FE", Replacement:="AW", LookAt:=xlWhole
Selection.Replace What:="FK", Replacement:="AW", LookAt:=xlWhole
Selection.Replace What:="ZU", Replacement:="AW", LookAt:=xlWhole
Range("E6").Select
Tabelle3.Select
,.....