Hi,
From my worksheet, I have two sets of columns. Let’s say “REFNAME” and “DESIGNNOTE”
These two columns am generating from a XML file. My final column formats like (“REFNAME, REFNAME2, DESIGNNOTE, REFNAME4, REFNAME5, REFNAME10, REFNAME13, REFNAME19, REFNAME20, REFNAME25, DESIGNNOTE1, REFNAME26, REFNAME32, and REFNAME34”)
Here each “REFNAME” is a section in the XML file. For all section in XML file REFNAME is the mandatory column and not necessarily all section should have the “DESIGNNOTE” for above example, section REFNAME2 and REFNAME25 only contains “DESIGNNOTE”
Requirement:
My requirement is I want section only contains “DESIGNNOTE” so except the columns REFNAME2, DESIGNNOTE and REFNAME25, DESIGNNOTE1 I want to delete the remaining columns permanently.
Can any one have solution for this.
<i used this code.>
Sub DeleteEmptyRow(File)
Dim i, j As Long
Dim LR, LC As Long
Workbooks(File).Activate
LR = ActiveSheet.UsedRange.Columns.Count
For i = LR To 1 Step -1
If Cells(1, i) = "REFNAME" And Cells(1, i + 1) = "DESIGNNOTE" Then
Else
ActiveSheet.Columns(i).Delete
End If
Next
End Sub
But this code is not working properly
From my worksheet, I have two sets of columns. Let’s say “REFNAME” and “DESIGNNOTE”
These two columns am generating from a XML file. My final column formats like (“REFNAME, REFNAME2, DESIGNNOTE, REFNAME4, REFNAME5, REFNAME10, REFNAME13, REFNAME19, REFNAME20, REFNAME25, DESIGNNOTE1, REFNAME26, REFNAME32, and REFNAME34”)
Here each “REFNAME” is a section in the XML file. For all section in XML file REFNAME is the mandatory column and not necessarily all section should have the “DESIGNNOTE” for above example, section REFNAME2 and REFNAME25 only contains “DESIGNNOTE”
Requirement:
My requirement is I want section only contains “DESIGNNOTE” so except the columns REFNAME2, DESIGNNOTE and REFNAME25, DESIGNNOTE1 I want to delete the remaining columns permanently.
Can any one have solution for this.
<i used this code.>
Sub DeleteEmptyRow(File)
Dim i, j As Long
Dim LR, LC As Long
Workbooks(File).Activate
LR = ActiveSheet.UsedRange.Columns.Count
For i = LR To 1 Step -1
If Cells(1, i) = "REFNAME" And Cells(1, i + 1) = "DESIGNNOTE" Then
Else
ActiveSheet.Columns(i).Delete
End If
Next
End Sub
But this code is not working properly