Remembering/passing Double clicked cell

Kabasauls

New Member
Joined
Jul 12, 2012
Messages
24
Hello,

I have a question on how to remember or pass the place where the user doubleclicks. I am trying to make a form show up when a certain range is chosen. For now this range is static, but it will be dynamic in the future. Once the user double clicksa cell in this range, the form pops up.

Code:
 Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Not Application.Intersect(Target, Range("M4:AF23")) Is Nothing Then
        Cancel = True
        InputFrm.Show
    End If
End Sub
.

Is there a way to pass the "Target" variable to the form?

This is a partial code of what I have in the form. I used "cell(1,1)" as a place holder, but I want to have a variable as a target or range that knows where the user double clicked. So it changes only that current cell.


Code:
 Private Sub CommandButton2_Click()

    Dim ColorChosen As String
    Dim WordChosen As String
    ColorChosen = ColorCmb.Value
    WordChosen = LetterCmb.Value
        
    If ColorChosen = "White" Then
        Selection.Interior.Pattern = xlNone
        If WordChosen = "NA" Then
            'cells(1,1) should be changed in  the future to save or pass user's range.
            Cells(1, 1).Value = "NA"
        ElseIf WordChosen = "NS" Then
            Cells(1, 1).Value = "NS"
        ElseIf WordChosen = "IP" Then
            Cells(1, 1).Value = "IP"
        ElseIf WordChosen = "C" Then
            Cells(1, 1).Value = "C"
        ElseIf workdchosen = "A" Then
            Cells(1, 1).Value = "A"
        End If
End Sub
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Forum statistics

Threads
1,214,643
Messages
6,120,707
Members
448,981
Latest member
recon11bucks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top