Hello all,
I have the following code:
This code show look at the number that is on the active cell set that number as a variable; VFind. Then it needs to look onto worksheet Details, find the number on sheet Details and delete the CurrentRegion.
The code runs fine except it does not delete the right selection. For example if the number in selected cell is 1 it deletes 3. I don't understand why and any advice or help is much appreciated. Thank you!
I have the following code:
PHP:
Sub Delete_Section_click()
Dim ws As Worksheet
Set ws = Worksheets("Input_Data")
Dim Dws As Worksheet
Set Dws = Worksheets("Detail_Data")
VFind = ActiveCell.Value
Dws.Select
Cells.Find(VFind, After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
Selection.CurrentRegion.Select
Selection.EntireRow.Delete
ws.Select
Selection.EntireRow.Delete
End Sub
This code show look at the number that is on the active cell set that number as a variable; VFind. Then it needs to look onto worksheet Details, find the number on sheet Details and delete the CurrentRegion.
The code runs fine except it does not delete the right selection. For example if the number in selected cell is 1 it deletes 3. I don't understand why and any advice or help is much appreciated. Thank you!