Tally Sheet

R

RICK ROBERSON

I need to build up a tally sheet for tracking some maintenance frequencies, so as I am going through a large stack of these different procedures I want to be able to click on the appropriate cell and have it increment up one with the left mouse button or down with the right mouse button.I have Excel2003 and I have been trying to figure out how to make it happen with VBA and a custom function but it seems to be all set up for forms and I would like to make this happen right on the worksheet. I would really appreciate a pointer that could steer me in the right direction.
 
Z

zantor

Here is one way, but not the most elegant...

The following code will increase the value in "E4" by one if you doubl
click that cell with the left button. The value will decrease if yo
right-click on that cell. (Excel 97)

In a new workbook insert the following code under "Sheet1" in th
VBA-Project window (Do not insert it in a module it will not work!)

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range
Cancel As Boolean)
If Target.Address = "$E$4" Then
Cells(4, 5) = Cells(4, 5) + 1
End If
Cells(5, 5).Select
End Sub

Private Sub Worksheet_BeforeRightClick(ByVal Target As Excel.Range
Cancel As Boolean)
If Target.Address = "$E$4" Then
Cells(4, 5) = Cells(4, 5) - 1
End If
End Sub

Hope this helps..
 
R

RICK ROBERSON

I think it will help a lot. One more question as to how I would change that
to more then on cell or a certain range of cells

--
Rick Roberson
University of Phoenix Online
[email protected]
[email protected]
360 578-4695 (work)
360 423-7181 (home)
360 423-6571 (fax)
Pacific Time
 
T

Tom Ogilvy

Change
If Target.Address = "$E$4" Then

to
if Not Intersect(Target, Range("E1:E100,F5,G10:H20")) is nothing then


--
Regards,
Tom Ogilvy

RICK ROBERSON said:
I think it will help a lot. One more question as to how I would change that
to more then on cell or a certain range of cells

--
Rick Roberson
University of Phoenix Online
[email protected]
[email protected]
360 578-4695 (work)
360 423-7181 (home)
360 423-6571 (fax)
Pacific Time
 
Top