Skip to content

Instantly share code, notes, and snippets.

@harsha547
Created June 11, 2017 08:09
Show Gist options
  • Save harsha547/ccf8ef102e240db9b29d556e2e4dbec0 to your computer and use it in GitHub Desktop.
Save harsha547/ccf8ef102e240db9b29d556e2e4dbec0 to your computer and use it in GitHub Desktop.
Sub columndelete()
Dim lrow As Long
Dim lcolumn As Long
lcolumn = Sheet1.Range("A4").CurrentRegion.Columns.Count
lrow = Sheet2.Range("f1").CurrentRegion.Rows.Count
For j = 1 To lrow
For i = 1 To lcolumn
If Sheet1.Cells(4, i).Value = Sheet2.Cells(j, 5).Value Then
Sheet1.Columns(i).Delete
End If
Next i
Next j
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment