Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Get current cell after OK on user form?
I made a user form that opens when you double-click in certain cells. On
the form, you write some values, and then click OK. In the code for the OK button, how do you know what cell the user double-clicked on? Gustaf |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Get current cell after OK on user form?
Hi Gustaf
This line needs to go before your code select other cells. TargetCell= activecell.address Regards, Per "Gustaf" skrev i meddelelsen ... I made a user form that opens when you double-click in certain cells. On the form, you write some values, and then click OK. In the code for the OK button, how do you know what cell the user double-clicked on? Gustaf |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Get current cell after OK on user form?
Copy the worksheet code into a sheet module and add a userform with a button
for the form code. Double-click a cell within A1:B10. ' Worksheet code Private Sub Worksheet_BeforeDoubleClick( _ ByVal Target As Range, Cancel As Boolean) If Intersect(Range("A1:B10"), Target) Is Nothing Then Exit Sub Cancel = True Set UserForm1.mCellClicked = Target UserForm1.Show End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) End Sub '' end worksheet module '' userform code Public mCellClicked As Range Private Sub CommandButton1_Click() ' the OK button MsgBox mCellClicked.Address & vbCr & _ mCellClicked.Parent.Name End Sub I suspect the above will be enough for your needs but you might also look into Property Set/Let and Get pairs (Set for objects or Let for variables). Regards, Peter T "Gustaf" wrote in message ... I made a user form that opens when you double-click in certain cells. On the form, you write some values, and then click OK. In the code for the OK button, how do you know what cell the user double-clicked on? Gustaf |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
inserting current windows user id into a cell | Excel Worksheet Functions | |||
How do I fill a cell in a user form from a selection on same form? | Excel Discussion (Misc queries) | |||
Data from user form to certain cell | Excel Programming | |||
Determine the current cell while inside a User Defined Function | Excel Programming | |||
current cell in user-defined function | Excel Programming |