AW: Spaltenbreite in cm
03.02.2004 17:38:26
DieterB
Hallo Andrea,
hier der VBA-Code
Sub Format_Spalten_ZeilenMM()
Dim sBreite As Single
Dim sAktuell As Single
Dim strText As String
Dim strAntwort As String
Dim ZHöhe As Single
Dim ZAktuell As Single
On Error GoTo Fehler
Spalte = Selection.ColumnWidth
sAktuell = (Selection.ColumnWidth + 0.71) / 5.1425 * 10
strText = "Aktuelle Spaltenbreite in mm: " & _
Format(sAktuell, "###0.00 mm") & Chr(13) _
& "Gib die gewünschte Spaltenbreite für die " & _
"aktuelle Markierung in mm ein:"
strAntwort = InputBox(strText, "Neue Spaltenbreite festlegen", _
Format(sAktuell, "###0.00"))
If strAntwort <> "" Then
sBreite = Val(strAntwort)
'sBreite = CSng(strAntwort)
Selection.ColumnWidth = -0.71 + 5.1425 * sBreite / 10
End If
ZAktuell = Selection.RowHeight
Faktor = 2.999999
ZAktuell = ZAktuell / Faktor '(Selection.RowHeight)
strText = "Aktuelle Zeilenhöhe in mm: " & _
Format(ZAktuell, "###0.00 mm") & Chr(13) _
& "Gib die gewünschte Zeilenhöhe für die " & _
"aktuelle Markierung in mm ein:"
strAntwort = InputBox(strText, "Neue Zeilenhöhe festlegen", _
Format(ZAktuell, "###0.00"))
If strAntwort <> "" Then
ZHöhe = CSng(strAntwort)
Selection.RowHeight = Faktor * ZHöhe
End If
Range("A1").Select
Exit Sub
Fehler:
Range("A1").Select
End Sub
Gruß
DieterB