Keyboard shortcut for highlighting cell

L

Legacy 232375

Guest
What is the keyboard shortcut for highlighting cell? Can a frequently-performed task be assigned a keyboard shortcut by user? If it is done by VBA, please post the code.

Thanks.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
You could do this by recording a macro. First click 'Record Macro'. When the window opens, name your macro and also input your desired keystroke in the 'Shortcut key' box. Using the dropdown, you can also choose where you want the macro to be stored, either in the current file or in your personal macro workbook. Click OK then choose your background color. Then click 'Stop Recording'. Now, every time you hold down Ctrl with the keystroke you selected, the background color will change.
 
Upvote 0
I am new to macro myself but here is a try
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim r As Range
Dim A As Range
Set r = Range(Target.Address)
Set A = Range("A1:AZ200")
If Target.Cells.Count > 1 Then Exit Sub
A.Interior.ColorIndex = xlNone
r.Interior.ColorIndex = 6

End Sub
 
Upvote 0
Wonderful, it worked! So does this mean, I can perform any set of tasks with a single stroke by recording them into a macro?
And Why is that I'm not able to undo this once I used the macro?
Thank You.
 
Last edited by a moderator:
Upvote 0
Once a macro has been run the Undo stack is cleared.
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,843
Members
449,051
Latest member
excelquestion515

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