Spalte C:C mit Namen ansprechen - aber wie?
13.03.2017 10:23:40
cH_rI_sI
Guten Morgen!
Wie kann ich Spalte C:C mit dem vergebenen Namen ("Bemerk_START") ansprechen?
Es geht konkret um folgenden Code:
Sub ZeileFormatieren(Zeile As Long, ws As Worksheet)
'Breite der verbundenen Zellen bestimmen
Dim Breite As Long
Dim BreiteG As Long
Dim SP As Long
For SP = 3 To 17
Set ws = Worksheets("Zusammenfassung (BL2)")
Breite = Columns(SP).ColumnWidth
BreiteG = BreiteG + Breite
Next SP
Columns("C:C").ColumnWidth = BreiteG
With ws.Range(ws.Cells(Zeile, 1), ws.Cells(Zeile, 17))
.Interior.Pattern = xlNone
.Font.Bold = False
.Font.Size = 10
.WrapText = True
.Rows.EntireRow.AutoFit
.Columns("C:C").ColumnWidth = BreiteG 'vorher fixer Wert von 55
.Rows.EntireRow.AutoFit
.Columns("C:C").ColumnWidth = 5
End With
With ws.Range(ws.Cells(Zeile, 1), ws.Cells(Zeile, 2)).Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
With ws.Range(ws.Cells(Zeile, 1), ws.Cells(Zeile, 2)).Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
With ws.Range(ws.Cells(Zeile, 1), ws.Cells(Zeile, 2)).Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
With ws.Range(ws.Cells(Zeile, 1), ws.Cells(Zeile, 2)).Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
With ws.Range(ws.Cells(Zeile, 3), ws.Cells(Zeile, 17)).Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
With ws.Range(ws.Cells(Zeile, 3), ws.Cells(Zeile, 17)).Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
With ws.Range(ws.Cells(Zeile, 3), ws.Cells(Zeile, 17)).Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
With ws.Range(ws.Cells(Zeile, 3), ws.Cells(Zeile, 17)).Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
ws.Range(ws.Cells(Zeile, 1), ws.Cells(Zeile, 2)).Merge
ws.Range(ws.Cells(Zeile, 3), ws.Cells(Zeile, 17)).Merge
End Sub
Bitte um Hilfe - Danke!Lg,
Chrisi