AW: wenn zelle/ zeile aktiv dann combobox
03.09.2004 19:46:56
k.Rola
Hallo,
ist zwar nicht genau das, was du willst, vielleicht kannst du es ja dennoch verwenden.
''-----------------------------------------------------------------------------------
Diesen Code in das Modul von "DieseArbeitsmappe":
Option Explicit
Private Sub Workbook_Activate()
Call Menu_make
End Sub
Private Sub Workbook_Deactivate()
Call Menu_delete
End Sub
''------------------------------------------------------------------------------
Diesen Code ins Modul der entsprechenden Tabelle:
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.CommandBars(MNAME).Visible = Target.Column = 2 And Target.Count = 1
End Sub
''------------------------------------------------------------------------------
Diesen Code in ein Standardmodul:
Option Explicit
Public Const MNAME As String = "Datumspalte..."
Sub Menu_make()
Dim cb As Object, cbb As Object, i As Byte
Call Menu_delete
Set cb = CommandBars.Add(MNAME)
For i = 1 To 4
Set cbb = cb.Controls.Add(1)
With cbb
.Style = 2
.BeginGroup = True
.TooltipText = "Spalte wählen..."
.Caption = Chr(i + 72)
.Tag = i + 8
.OnAction = "Datum_Spalte"
.Width = 24
End With
Next
With cb
.Visible = False
.Position = 4
.Protection = 27
End With
End Sub
Sub Menu_delete()
On Error Resume Next
CommandBars(MNAME).Delete
End Sub
Sub Datum_Spalte()
Dim s As Integer
s = CommandBars.ActionControl.Tag
If ActiveCell.Column = 2 Then
Cells(ActiveCell.Row, s) = Date
End If
CommandBars(MNAME).Visible = False
End Sub
''--------------------------------------------------------------------------------
Gruß K.Rola