rakupareek
New Member
- Joined
- Dec 29, 2023
- Messages
- 38
- Office Version
- 2016
- Platform
- Windows
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
Dim cell As Range
Dim dataSheet As Worksheet
Dim selectedValue As String
Set rng = Me.Range("A4:A22")
Set dataSheet = ThisWorkbook.Sheets("Data Input Sheet")
If Not Intersect(Target, rng) Is Nothing Then
Application.EnableEvents = False
For Each cell In Intersect(Target, rng)
If cell.Value = "House Rent Allowance" Then
Me.Range("P" & cell.Row).Value = dataSheet.Range("F14").Value
ElseIf cell.Value = "Children Edu Allowance" Then
Me.Range("P" & cell.Row).Value = dataSheet.Range("F18").Value
ElseIf cell.Value = "Children Hostel Allowance" Then
Me.Range("P" & cell.Row).Value = dataSheet.Range("F19").Value
Else
Me.Range("P" & cell.Row).ClearContents
End If
Next cell
Application.EnableEvents = True
End If
Exit Sub
End Sub
Using this VBA but when I change some value in Data Input Sheet then data does not refresh.
Can possible to refresh data automatic when I change any value