This is my Current line of Code on my sheet. Its purpose it to autofill a blank cell with a remaining value. My goal is to apply this same code two more times for two other independent range of cells. The Second range of cells is K4, N4, and P4, and the Third Range of cells is V4, AC4, AG4, AK4, and AO4. How would i go about combining the code so it can individually apply to all three ranged cells?
Code:
Private Sub Worksheet_Change(ByVal Target As Range)Const csMONITOR_RANGE As String = "C4,F4,I4"
Dim rMonitor As Range
Dim vValue
If Not Intersect(Target, Range(csMONITOR_RANGE)) Is Nothing Then
Set rMonitor = Range(csMONITOR_RANGE)
If Intersect(Target, rMonitor).Cells.Count < 3 Then
If Application.Count(rMonitor) = 2 Then
Application.EnableEvents = False
rMonitor.SpecialCells(xlCellTypeBlanks).Value = 1 - Application.Sum(rMonitor)
Application.EnableEvents = True
ElseIf Application.Count(rMonitor) = 3 Then
vValue = Intersect(Target, rMonitor).Value
Application.EnableEvents = False
rMonitor.ClearContents
Intersect(Target, rMonitor).Value = vValue
Application.EnableEvents = True
End If
End If
End If
End Sub
Last edited by a moderator: