Highlight cells then perform action

mistersteve

Board Regular
Joined
Aug 18, 2014
Messages
110
Office Version
  1. 365
Hello, hope someone can help.

I wold like to drag my mouse to highlight some cells.

Then with the cell highlighted, type in a character that will apply to all the cells

patiently awaiting advice.

Steve T
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
If the cells are empty then type as normal, then hold ctrl and press enter.
 
Upvote 0
Try this:-
Colour Yellow target Range , Code limited to Columns "A to E"
Code:
Option Explicit
Dim R As Range
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, R) Is Nothing Then
    R.Value = Target.Value
    Set R = Nothing
End If
End Sub


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Columns("A:E")) Is Nothing Then
    Target.Interior.ColorIndex = 6
        If Target.Count > 1 Then Set R = Target
End If
End Sub
 
Upvote 0
Sometimes I am not good at explaining myself.

so in detail:

I have a calendar, when I want to fill in someone's "holiday, "Half-day" or "sick"

I would like to drag the mouse over the days (which would then be highlighted).

And type the character (only once) "H", "HD", "S".

The cells would then show the character in each and be coloured too.

Hope I make better sense

Steve T
 
Upvote 0
For entering what you type in all selected cells see my original suggestion.

If you want them coloured to highlight the various entries then conditional formatting should do it.
 
Upvote 0
Jason, you are a star.

Now can I make this idiot proof? you see I wont be entering the data, someone else will.

Could this be done by highlighting the cells, then pressing a separate button to enter the "h" onto all the cells in one go.

Maybe a macro?

Steve T
 
Upvote 0
Resistant maybe, but idiot proof is virtually impossible. You could enter something like

Code:
Selection.Value ="h"

in the button code, but if the user doesn't approve the security warning to enable macros then the button will not work.
 
Upvote 0

Forum statistics

Threads
1,223,460
Messages
6,172,345
Members
452,454
Latest member
MadamRedRabbit

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