Cave_Johnson
New Member
- Joined
- Jan 20, 2022
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
Hi all,
What I'm trying to do is fill a shape or cell (whichever is easiest to code!) with specific text depending on which cell is selected. The text is located on a different sheet in the same workbook. I'd also like a default text to be in there if any other cell is selected.
It'll end up being a lot more detailed than this (I think there will be 20+ options), but if I can get the grammar right then I should be able to fill out the rest.
What's wrong with that!?
What I'm trying to do is fill a shape or cell (whichever is easiest to code!) with specific text depending on which cell is selected. The text is located on a different sheet in the same workbook. I'd also like a default text to be in there if any other cell is selected.
It'll end up being a lot more detailed than this (I think there will be 20+ options), but if I can get the grammar right then I should be able to fill out the rest.
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Range("B4:K4"), Target) Is Nothing Then
Sheets("Definitions").Range("B2").Copy
Sheets("Target").Activate
Range("M10"). Select
ActiveSheet.Paste
Application.CutCopyMode = False
ElseIf Not Intersect(Range("B5:K5"), Target) Is Nothing Then
Sheets("Definitions").Range("C2").Copy
Sheets("Target").Activate
Range("M10"). Select
ActiveSheet.Paste
Application.CutCopyMode = False
Else
Sheets("Definitions").Range("A2").Copy
Sheets("Target").Activate
Range("M10"). Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
What's wrong with that!?