thespardian
Board Regular
- Joined
- Aug 31, 2012
- Messages
- 119
- Office Version
- 2016
- 2013
- Platform
- Windows
Hi there!
Back in Oct, 2019, CharlieRog posted a question and the @Fluff suggested the code. I just changed the sheet name and cell references in the suggested code and it works for me. But I want to add the following task.
If I delete any value in column C on sheet3 the value in Column B on sheet 3 should automatically be deleted. Any help will be highly appreciated.
The codes are as under:
Back in Oct, 2019, CharlieRog posted a question and the @Fluff suggested the code. I just changed the sheet name and cell references in the suggested code and it works for me. But I want to add the following task.
If I delete any value in column C on sheet3 the value in Column B on sheet 3 should automatically be deleted. Any help will be highly appreciated.
The codes are as under:
VBA Code:
Sub Sheet3ColB()
Dim Cl As Range
Dim Dic As Object
Set Dic = CreateObject("scripting.dictionary")
With Sheet2
For Each Cl In .Range("A3", .Range("A" & Rows.Count).End(xlUp))
Dic(Cl.Value) = Cl.Offset(, 5).Value
Next Cl
End With
With Sheet3
For Each Cl In .Range("C3", .Range("C" & Rows.Count).End(xlUp))
If Dic.exists(Cl.Value) Then Cl.Offset(, -1).Value = Dic(Cl.Value)
Next Cl
End With
End Sub