Hello all,
I am trying to design a macro which will delete the active cell as well as the details of that active cell on a separate sheet. The data is organized in the following manner on the main sheet:
ColA ColB ColC ColD ColE
1 Data 25 25 25
And on the detail sheet its organized as follows:
ColA ColB ColC ColD ColE
1
Data
25
25
25
Basically I want to search for the number on top labelled as 1 (not always 1 could be 2 or 20) and delete the entire row from the main sheet and delete all the rows that contain the same data in the detail sheet.
Please note that there will be additional information above and below the data sets in both sheets, however, the data of question is separated by a blank row.
I have the following coding which does not work and I am trying to figure out the best approach:
Any help is appreciated.
I am trying to design a macro which will delete the active cell as well as the details of that active cell on a separate sheet. The data is organized in the following manner on the main sheet:
ColA ColB ColC ColD ColE
1 Data 25 25 25
And on the detail sheet its organized as follows:
ColA ColB ColC ColD ColE
1
Data
25
25
25
Basically I want to search for the number on top labelled as 1 (not always 1 could be 2 or 20) and delete the entire row from the main sheet and delete all the rows that contain the same data in the detail sheet.
Please note that there will be additional information above and below the data sets in both sheets, however, the data of question is separated by a blank row.
I have the following coding which does not work and I am trying to figure out the best approach:
PHP:
Sub Delete_Section_click()
Dim ws As Worksheet
Set ws = Worksheets("Report")
Dim Dws As Worksheet
Set Dws = Worksheets("Detail_Data")
Dim VFind As Range
VFind = ActiveCell.Value
VFind.EntireRow.Delete
Dws.Select
Cells.Find(VFind, after:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False).Activate
Range(VFind, Cells(Rows.Count, VFind.Column).End(xlUp)).Select
EntireRow.Delete
End Sub
Any help is appreciated.