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

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
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
 
Upvote 0

Forum statistics

Threads
1,214,971
Messages
6,122,525
Members
449,088
Latest member
RandomExceller01

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
Back
Top