D
DDawson
I'm trying to create a validation macro to enter text into the cell of range
G:G depending on the contents of the adjacent cells in columns C and D. This
is what I have done to start with, there are other ElseIf entries to be
added, but it is really slow to start with.
Private Sub Worksheet_Calculate()
Dim myC As Range
Dim WatchRange1 As Range
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
End With
Set WatchRange1 = Range("G2:G500")
For Each myC In WatchRange1
If myC.Offset(0, -3).Value = "Contract1" And _
myC.Offset(0, -4).Value = "Status A" Then
myC.Cells.Value = "Response A"
ElseIf myC.Offset(0, -3).Value = "Contract 2" And _
myC.Offset(0, -4).Value = "Status A" Then
myC.Cells.Value = "Response B"
Else: myC.Cells.Value = ""
End If
Next myC
With Application
.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
End With
End Sub
G:G depending on the contents of the adjacent cells in columns C and D. This
is what I have done to start with, there are other ElseIf entries to be
added, but it is really slow to start with.
Private Sub Worksheet_Calculate()
Dim myC As Range
Dim WatchRange1 As Range
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
End With
Set WatchRange1 = Range("G2:G500")
For Each myC In WatchRange1
If myC.Offset(0, -3).Value = "Contract1" And _
myC.Offset(0, -4).Value = "Status A" Then
myC.Cells.Value = "Response A"
ElseIf myC.Offset(0, -3).Value = "Contract 2" And _
myC.Offset(0, -4).Value = "Status A" Then
myC.Cells.Value = "Response B"
Else: myC.Cells.Value = ""
End If
Next myC
With Application
.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
End With
End Sub