Inserting with mouse click

R

Rick Wolfe

I have a form which I developed using XL which involves inserting 'X' into a
series of boxes which in turn collects the data and generates a numerical
formula which returns a dollar value. Is there a way to have those boxes
activated with a mouse click rather than having to type in an 'X' each time?
 
G

Gord Dibben

Rick

What type of "Form"? Excel User Form or just a table layout on a worksheet?

What type of "Boxes"? Simple cells?


Gord Dibben MS Excel MVP
 
G

Gord Dibben

Rick

Attaching workbooks in these news groups is frowned upon and many people will
not open them.

I noticed the Malaspina Coach Lines

Since you're on the Powell River run, I'll give you a break this once<g>

You can add this event code to the sheet and do a double click to enter an "X"
in E9:E39 and I9:I39

Private Sub Worksheet_BeforeDoubleClick(ByVal _
Target As Range, Cancel As Boolean)
Const MY_RANGE As String = "E9:E39, I9:I39"
On Error GoTo CleanUp
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(MY_RANGE)) Is Nothing Then
For Each cell In Target
If cell.Value = "" Then
With cell
.Value = "x"
End With
End If
Ne
Cancel = True
End If
CleanUp:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on Ticket Input sheet tab and "View Code"

Copy/paste the code into that sheet module. Alt + q to return to the Excel
window.


Gord Dibben MS Excel MVP

Ex Powell Riverite now residing in Parksville on the Island.
 
R

Rick Wolfe

Thank you, Gord! Parksville is a great place! I remember it well as the
vacation location for a young boy living in Victoria. We would take the E &
N. Oh! what marvelous memories.
Thank you once again!
 
G

Gord Dibben

You're very welcome Rick

My daughter and hubby and two grandkids living in Powell River


Gord
 
R

Rick Wolfe

Gord, I attempted what you suggested and I get a compile error: sub or
function not defined.
On the worksheet code the cursor is on the word "ne".

Gord, I would like to learn more about Excel and the behind the scenes part
of working with Excel sheets. Any website you would suggest that would help
me learn a little more?
 
D

Dave Peterson

For Each cell In Target
If cell.Value = "" Then
With cell
.Value = "x"
End With
End If
Next Cell '<--fixed typo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top