Supportnet / Forum / Tabellenkalkulation
Makro: Von MS Project 2002 Prof. nach Excel und dann in Excel richtig Formatieren
Frage
Hallo!
Ich erstelle in MS Project über ein Schema eine Exceldatei mit allen benötigten Infos. Diese Exceldatei möchte ich nehmen, richtig Formatieren und dann damit Berichte anzeigen.
Ich stelle mir das so vor:
1. Makro:
Formatiert alle Felder (Aus ´Datum und Uhrzeit´ nur Datum, Erste Zeile Fettschrift, optimale Spaltengröße, , usw.). Ich mache das so:
======================================
Sub Makro_Formatierung()
´
´ Felder ohne Std. und Tage: Spalte Vorgangstabelle1
´
Sheets("Vorgangstabelle1").Select
Columns("H:J").Select
Selection.Replace What:=" Std.", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:=" Tage?", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
.
.
.
´
´ Datum ohne Uhrzeit: Spalte Vorgangstabelle1
´
Sheets("Vorgangstabelle1").Select
Columns("B:C").Select
Selection.NumberFormat = "m/d/yyyy"
´
.
.
.
´
´ Feldformatierung Dezimal: #.##0,00;[Rot]-#.##0,00: Spalte Vorgangstabelle1
´
Sheets("Vorgangstabelle1").Select
Columns("H:J").Select
Selection.NumberFormat = "#,##0.00;[Red]-#,##0.00"
´
.
.
.
´
´ Formatierung: 1. Zeile Fettschrift, Optimale Spaltenbreite und Gitter: Spalte Vorgangstabelle1
´
Sheets("Vorgangstabelle1").Select
Rows("1:1").Select
With Selection.Font
.Name = "Arial"
.FontStyle = "Fett"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Cells.Select
Selection.Columns.AutoFit
Cells.Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
´
.
.
.
End With
End Sub
======================================
Leider formatiert das Makro die Tage- und Stundenzellen nicht richtig als Zahl (als Textdefiniert links und als Zahl definiert rechts in der Spalte.
Was mache ich falsch???
2. Makro
Ich möchte nachher nur bestimmte Spalten Makrogesteuert (Bericht 1 bis 10) von der Gesamtheit anzeigen lassen. Grund ist, dass ich immer eine Datendatei habe und über ein Makro (1- 10) sage welche Spalten ich sehen möchte und dann nur diese ausdrucken kann.
Gibt es da eine bessere Lösung?
Viele Grüße
Niels