Makro für autom. füllen von LinkedCell in Excel
Hallo Ihr lieben,
ich hab da ein kleines Problem mit meiner Excel Tabelle.
Und zwar hab ich in einer Excel Tabelle über die Steuerelement-Toolbox mehrere Optionsfelder und Kontrollkästchen eingebaut. Diese Kontrollboxen bzw. Optionsfelder sollen nun jeweils mit einer Zelle (am besten die Zelle links daneben) verbunden werden.
Manuell funktioniert das ganz gut über Eigenschaften - LinkedCell. Könnte mir vielleicht jemand eine Funktion basteln, welche alle LinkedCell Werte für alle Kontrollboxen bzw. Optionsfelder vergibt.
Hier ein Beispiel, welches allerdings nur bei Formular-Kontrollboxen funktioniert:
-----------------------
Option Explicit
Sub CheckBoxen()
Dim Sh As Shape
For Each Sh In ActiveSheet.Shapes
If Sh.Type = msoFormControl Then
If Sh.FormControlType = xlCheckBox Then
Sh.ControlFormat.LinkedCell = Cells(Sh.TopLeftCell.Row, Sh.TopLeftCell.Column - 2).Address
End If
End If
Next
End Sub
---------------------
Danke für Eure Hilfe....
Antwort schreiben
Antwort 1 von micha28 vom 24.05.2019, 19:33 Options
Kann mir keiner helfen?
Antwort 2 von Beverly vom 24.05.2019, 22:21 Options
Hi Micha,
Sub oleobjekte()
Dim ob As OLEObject
For Each ob In ActiveSheet.oleobjects
If TypeName(ob.Object) = "OptionButton" Or TypeName(ob.Object) = "CheckBox" Then
ob.LinkedCell = Cells(ob.TopLeftCell.Row, ob.TopLeftCell.Column).Address
End If
Next
End Sub
Bis später,
Karin
Antwort 3 von micha28 vom 25.05.2019, 13:04 Options
Spitze ... jetzt klappts!
@Karin
vieeeeelen Dank
LG,
Micha
Antwort 4 von micha28 vom 25.05.2019, 13:41 Options
Hi,
ich bins nochmal....
Ich würde den gleichen Code gerne für ein zweites Update verwenden. Und zwar würde ich gerne den GroupName bearbeiten...
So funktioniert es leider nicht:
Sub oleobjekte()
Dim ob As OLEObject
For Each ob In ActiveSheet.oleobjects
If TypeName(ob.Object) = "OptionButton" Or TypeName(ob.Object) = "CheckBox" Then
ob.GroupName = Cells(ob.TopLeftCell.Row, ob.TopLeftCell.Column +1).value
End If
Next
End Sub
Kann mir jemand sagen wie ich die Eigenschaft "GroupName" ansprechen kann !?!?!?
Danke :-)