GoodWithExcelNotVBA
New Member
- Joined
- Jul 26, 2010
- Messages
- 7
Hi,
I'm new to this forum, and to VBA really, and I'm trying to format a range of cells a certain way once a separate cell has a certain text entered into it (chosen from a list), such as "Welcome Home". I've pieced together a few bits of code that I found hunting around for my answer, but I can't seem to get it to work the way I want (the specific code shown below doesn't even work, but I feel it's closest to where I'm trying to get). Again, I have no programming knowledge, so there are probably some extraneous pieces of code in here, but here is my starting point:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
Set KeyCells = Range("B53")
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing And Target.Range = "Welcome Home" Then
Range("A54:F62").Select
With Selection.Interior
.ColorIndex = 48
.Pattern = xlSolid
End With
Rows("54:62").Select
Selection.RowHeight = 10
Range("B64").Select
End If
End Sub
I used the record macro feature to get the formatting part the way I want it, so that part is not an issue. I just need to try to figure out the trigger issue -- if it's even possible. Thanks so much for any help!
Jordan
I'm new to this forum, and to VBA really, and I'm trying to format a range of cells a certain way once a separate cell has a certain text entered into it (chosen from a list), such as "Welcome Home". I've pieced together a few bits of code that I found hunting around for my answer, but I can't seem to get it to work the way I want (the specific code shown below doesn't even work, but I feel it's closest to where I'm trying to get). Again, I have no programming knowledge, so there are probably some extraneous pieces of code in here, but here is my starting point:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim KeyCells As Range
Set KeyCells = Range("B53")
If Not Application.Intersect(KeyCells, Range(Target.Address)) _
Is Nothing And Target.Range = "Welcome Home" Then
Range("A54:F62").Select
With Selection.Interior
.ColorIndex = 48
.Pattern = xlSolid
End With
Rows("54:62").Select
Selection.RowHeight = 10
Range("B64").Select
End If
End Sub
I used the record macro feature to get the formatting part the way I want it, so that part is not an issue. I just need to try to figure out the trigger issue -- if it's even possible. Thanks so much for any help!
Jordan