Pass Cell Reference to Submit Button

quirkycanuck

New Member
Joined
Nov 25, 2015
Messages
4
I have a Submit Button on a Userform that I'm trying to use to pass data from a listbox back into a specific cell on my worksheet. The sequence is as follows:

Worksheet_BeforeDoubleClick sub calls the userform
Userform displays the list box and user can select multiple options
Submit button under Listbox is clicked, and then the listbox items that are checked go back into the cell that was double-clicked.

The trick is passing the range variable. So far I've gotten half way there. I now have code in my doubleclick sub that passes the range address to a cell on the worksheet from where I can then hopefully retrieve it.

I can't figure out how to go in the other direction and convert "A1" in the cell on my worksheet into a range so that I can use that to populate the data.

How can I pass the address of the doubleclick to my submit button? Is there a simpler way, or would someone at least have the tidbit I need to convert the string "A1" on the spreadsheet back to a range in my VBA?

Thanks
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hi
How about
In the doubleclick event
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

    Set Cl = Target
    UserForm1.Show
End Sub
On your button
Code:
Private Sub CommandButton1_Click()
Cl.Value = "Hi"
Unload Me
End Sub
and then at the very top of a standard module put
Code:
Public Cl As Range
 
Upvote 0
Solution
or would someone at least have the tidbit I need to convert the string "A1" on the spreadsheet back to a range in my VBA?

Hi, for example, this will put a 1 in the cell address that is mentioned in cell A1 of the active sheet.

Rich (BB code):
Range(Range("A1").Value).Value = 1
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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