How get macro to type into cells that user manually selects

L

Legacy 374719

Guest
Hi, I made a simple macro, with recording, where I select the cell, press macro it will change background , change the don't colour and type the word I need, however if I select manually the range of cells where I'd like the same acronym to be typed, it just typos it into first cell and not into any other, though it changes the background for all. Any help online seems to be pointing towards predefined usr selected range, but I need it to perform the action on cells that I manually select.

It's a to mark peoples availability so people would constantly select different dates. So it needs to be based on something that user selects (not fixed cells) and fills into all selected cells.

Thank you
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
If you are working with multiple cells then it could be that you'll need some sort of loop.

Can you post the code you have?
 
Upvote 0
Hi Norie

Here's the code
Code:
Sub Blue()
'
' Blue Macro
'

'
    With Selection.Interior
        .Pattern = xlSolid
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorLight2
        .TintAndShade = -0.249977111117893
        .PatternTintAndShade = 0
    End With
    With Selection.Font
        .ThemeColor = xlThemeColorDark1
        .TintAndShade = 0
    End With
    ActiveCell.FormulaR1C1 = "PY"

End Sub

I can see that it types PY into active cell, but I need it to type it into all cells that user has selected. which is dynamic as people mark different days for themselves and would just click the button to fill the selected cells with the PY.
 
Upvote 0
All you should need to so is change ActiveCell to Selection.
 
Upvote 0
That worked! Perfect, much simpler than I thought.

Thank you Norie! much appriciated
 
Upvote 0

Forum statistics

Threads
1,214,943
Messages
6,122,380
Members
449,080
Latest member
Armadillos

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