insert value in cell

wfar

New Member
Joined
Sep 23, 2002
Messages
9
I want to either input a date value in column C and ,or run a macro that will copy the last filled cells date and copy this - 1 day to the cell i have selected
I would like to use the onkey event to run this macro when required
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Yogi Anand

MrExcel MVP
Joined
Mar 12, 2002
Messages
11,454
On 2002-10-04 18:43, wfar wrote:
I want to either input a date value in column C and ,or run a macro that will copy the last filled cells date and copy this - 1 day to the cell i have selected
I would like to use the onkey event to run this macro when required

Hi wfar:

I am going to make an assumption here. I am going to assume we would be operating on cell c2 -- that means whenever I click on cell C2 (with the associated OnKey being enabled), the value in cell C2 will be reduced by 1. I have used the CTRL and + key combinations (i.e. CTRL-SHIFT-+)

There are three subs -- the first sub houses the procedure that is executed on actuating the OnKey method; second sub is to enable the OnKey Method, the third sub is to disable the OnKey Method

Code:
Sub InsertDateMinus1()
[c2] = [c2] - 1
End Sub

Sub yOnKeyEvent1()
Application.OnKey "^{+}", "InsertDateMinus1"
End Sub

Sub yOnKeyEvent1Disable()
Application.OnKey "^{+}"
End Sub

Regards!

Yogi
 

Forum statistics

Threads
1,143,615
Messages
5,719,721
Members
422,242
Latest member
hishamkhatri

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
Top