Noid67
New Member
- Joined
- Feb 18, 2024
- Messages
- 11
- Office Version
- 365
- Platform
- Windows
So I have a two part question. I am struggling to understand how to incorporate multiple worksheet changes into one sheet. I have seen the examples for using IF NOT INTERSECT, but cannot correlate it to my needs. I also have a formula that I need to run in multiple rows and is the second part of the worksheet change. Below is the code I currently have for a worksheet change that works perfectly:
I want to include this formula that affects a different cell in the same worksheet as above, but this also needs to trigger based on a change in cell(s) N2:N28
Any assistance is greatly appreciated.
VBA Code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim DestWH As String
Dim DWHRowNum As Long
Dim dt As Date
DWHRowNum = 2
dt = Format(Date, "mm/dd/yyy")
Application.EnableEvents = False
Do Until Cells(DWHRowNum, 2).Value = ""
Select Case Cells(DWHRowNum, 6).Value
Case Is = "ABQ1"
Cells(DWHRowNum, 7).Value = dt
Cells(DWHRowNum, 8).Value = "17:00"
Case Is = "BFI4"
Cells(DWHRowNum, 7).Value = dt + 1
Cells(DWHRowNum, 8).Value = "04:30"
Case Is = "CLE2"
Cells(DWHRowNum, 7).Value = dt
Cells(DWHRowNum, 8).Value = "17:00"
Case Is = "DEN3"
Cells(DWHRowNum, 7).Value = dt
Cells(DWHRowNum, 8).Value = "17:00"
Case Is = "DEN4"
Cells(DWHRowNum, 7).Value = dt + 1
Cells(DWHRowNum, 8).Value = "04:30"
Case Is = "GEG1"
Cells(DWHRowNum, 7).Value = dt
Cells(DWHRowNum, 8).Value = "17:00"
Case Is = "LIT1"
Cells(DWHRowNum, 7).Value = dt
Cells(DWHRowNum, 8).Value = "17:00"
Case Is = "ORD5"
Cells(DWHRowNum, 7).Value = dt
Cells(DWHRowNum, 8).Value = "17:00"
Case Is = "ORF3"
Cells(DWHRowNum, 7).Value = dt
Cells(DWHRowNum, 8).Value = "17:00"
Case Is = "PAE2"
Cells(DWHRowNum, 7).Value = dt
Cells(DWHRowNum, 8).Value = "17:00"
Case Is = "PCW1"
Cells(DWHRowNum, 7).Value = dt
Cells(DWHRowNum, 8).Value = "17:00"
Case Is = "PDX9"
Cells(DWHRowNum, 7).Value = dt + 1
Cells(DWHRowNum, 8).Value = "04:30"
Case Is = "SLC1"
Cells(DWHRowNum, 7).Value = dt
Cells(DWHRowNum, 8).Value = "17:00"
Case Is = "SMF1"
Cells(DWHRowNum, 7).Value = dt + 1
Cells(DWHRowNum, 8).Value = "04:30"
End Select
DWHRowNum = DWHRowNum + 1
Loop
Application.EnableEvents = True
End Sub
I want to include this formula that affects a different cell in the same worksheet as above, but this also needs to trigger based on a change in cell(s) N2:N28
VBA Code:
Sub VRID_Status()
'
' VRID_Status Macro
'
ActiveCell.FormulaR1C1 = _
"=IF(RC[-10]="""","""",IF(AND(RC[-4]="""",RC[-3]>RC[-10]),""Future"",""Current""))"
Range("Q18").Select
End Sub
Any assistance is greatly appreciated.