Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Tally Sheet
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.
-- Rick Roberson |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Tally Sheet
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.. -- Message posted from http://www.ExcelForum.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Tally Sheet
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" wrote in message ... 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 360 578-4695 (work) 360 423-7181 (home) 360 423-6571 (fax) Pacific Time "zantor " wrote in message ... Here is one way, but not the most elegant... The following code will increase the value in "E4" by one if you double click that cell with the left button. The value will decrease if you right-click on that cell. (Excel 97) In a new workbook insert the following code under "Sheet1" in the 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... --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
I want to tally my sheet | Excel Worksheet Functions | |||
how do I create a tally sheet | Excel Discussion (Misc queries) | |||
By selecting cells adjacent to cells tally sheet | Excel Worksheet Functions | |||
create tally sheet for positions- insert names and tally # | Excel Discussion (Misc queries) | |||
Tally occurences of phrase on one sheet. | Excel Discussion (Misc queries) |