VBA-code for macro (Ctrl+a, Ctrl+b, etc.) to fill in digits in a set of two columns

CasperA

Board Regular
Joined
Jun 8, 2015
Messages
55
I am looking for code to assign the following macro:

Ctrl+[n1]: Fill the active cell in column [n2] with digit [n3] -> Go to the cell in the next column in the same row and fill in that cell with digit [n4]

n1 would be a variable letter (a, or b, or c, etc.)
n2 would be a variable column letter (A, or B, or C, etc.)
n3 would be a variable digit (1, or 2, or 3, etc.)
n4 would be a variable digit (1, or 2, or 3, etc.)

Does anyone know what the VBA-code would be for, for instance:
Ctrl+[a]: Fill the active cell with digit 1 -> Go to the cell in the next column in the same row and fill in that cell with digit 1

and for, for instance:
Ctrl+: Fill the active cell with digit 1 -> Go to the cell in the next column in the same row and fill in that cell with digit 7

If C14 would be the active cell,
macro Ctrl+[a] would lead to the following content being filled in: C14 -> 1 and D14 -> 1
macro Ctrl+ would lead to the following content being filled in: C14 -> 1 and D14 -> 7

CA
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

CasperA

Board Regular
Joined
Jun 8, 2015
Messages
55
If it is impossible to have a cell filled in with a digit, would it be possible to fill it in with the value of a cell that contains the requested digit? For instance from a column P in which P1 contains the digit 1, P2 the digit 2, etc.?
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,030
Messages
5,835,038
Members
430,333
Latest member
jaypatel1298

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