View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vasant Nanavati Vasant Nanavati is offline
external usenet poster
 
Posts: 1,080
Default Pop up a Form when Clicking a Cell

It would be easier to accomplish with a double-click, as there is no Click
event for a worksheet. You could use the SelectionChange method, but I don't
think that would accomplish exactly what you want.

Add UserForm1 to your project and then put the following code into the
worksheet's code module:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
Cancel = True
UserForm1.Show
End Sub

Of course, you would need to add the appropriate Label or TextBox controls
to the UserForm to display the contents of the row, and write the code to
populate them. Also, you would lose the normal double-click functionality
(in-cell editing).

--

Vasant





"WK" wrote in message
...
I have a worksheet and what I want is that when one clicks a row, a popup
form will show up, displaying the data from that row in a more user

friendly
screen. The worksheet will be generated programatically and could have
thousands of rows.

How can I link the row / cell to a form? Is it possible not to use a
worksheet control? I hope it will be simple enough so that when the form
shows up, I can calculate what row was selected in the sheet?

Any help will be appreciated.