Anzeige
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

relativer Zellbezug

Forumthread: relativer Zellbezug

relativer Zellbezug
08.10.2004 12:40:18
mimex
Hallo zusammen
Vor kurzem Hat mir Reinhard bei einem Problem sehr geholfen,aber ich stehe schon wieder am Berg.Vielleicht kann mir jemand weiterhelfen?
Ich möchte um die Spalte H - M einen Rahmen bilden (+ Fettschrift des Inhalts), wobei die Zeilenzahl des Rahmens immer 2 ist aber die Zeile nicht feststeht. Sie beginnt jedoch immer 5 Zeilen oberhalb des Endes und geht bis 4 Zeile oberhalb des Endes.
(Beispiel: Dokumentenende = Zeile 136, dann ein Rahmen + Fettschrift um Zeile 131 + 132, Spalte H - M)
Jetzt schon vielen Dank für Eure Hilfe
Anzeige

5
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: relativer Zellbezug
Uduuh
Hallo,
in ein Modul:

Sub RahmenUndFett()
Dim iLast As Integer
iLast = Range("H65536").End(xlUp).Row - 5
If iLast < 1 Then
MsgBox "Keine Daten"
Exit Sub
End If
With Range(Cells(iLast, 8), Cells(iLast + 1, 13))
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
.Font.Bold = True
End With
End Sub


Sub RahmenUndFett()
Dim iLast As Integer
iLast = Range("H65536").End(xlUp).Row - 5
If iLast < 1 Then
MsgBox "Keine Daten"
Exit Sub
End If
With Range(Cells(iLast, 8), Cells(iLast + 1, 13))
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
.Font.Bold = True
End With
End Sub

Anzeige
AW: relativer Zellbezug
Uduuh
Hallo,
in ein Modul:

Sub RahmenUndFett()
Dim iLast As Integer
iLast = Range("H65536").End(xlUp).Row - 5
If iLast < 1 Then
MsgBox "Keine Daten"
Exit Sub
End If
With Range(Cells(iLast, 8), Cells(iLast + 1, 13))
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
.Font.Bold = True
End With
End Sub

C
Udo

Anzeige
AW: relativer Zellbezug
08.10.2004 12:57:09
Matthias
Hallo Minimex oder wie immer du wirklich heißt,
mein Vorschlag:

Sub tt()
Dim z
Dim ber As Range
z = Range("A65536").End(xlUp).Row 'ermittelt die letzte Zeile
Set ber = Range(Cells(z - 5, 8), Cells(z - 4, 13))
With ber
.Borders(xlDiagonalDown).LineStyle = xlNone
.Borders(xlDiagonalUp).LineStyle = xlNone
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
.Borders(xlInsideVertical).LineStyle = xlNone
.Borders(xlInsideHorizontal).LineStyle = xlNone
.Font.Bold = True
End With
End Sub

Den letzten Teil hab ich vom Makrorekorder übernommen, deshalb etwas sperrig.
Gruß Matthias
Anzeige
AW: relativer Zellbezug -
Galenzo
Hallo,
das sollte dabei helfen:
With Cells(Rows.Count, "A").End(xlUp).Offset(0, 7).Range("a1:f1")
.Borders(xlEdgeLeft).Weight = xlThick
.Borders(xlEdgeTop).Weight = xlThick
.Borders(xlEdgeBottom).Weight = xlThick
.Borders(xlEdgeRight).Weight = xlThick
End With
Das Dokumentenende wird hierbei in Spalte A gesucht - das kannst du dann ja entsprechend anpassen.
Viel Erfolg!
Anzeige
AW: relativer Zellbezug -
11.10.2004 19:50:21
Mimex
Ich danke Euch allen vielmals für die prompte Hilfe. Es hat prima geklappt mit Eurer Hilfe.
Herzlichen Dank
;

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige