Hello,
I am having trouble with my VBA code where I am supposed to clear contents of the entire column except the column header. The code I have so far only clears the column header and I am not sure how exactly to change it to help with my issue. P.S. this is part of a larger procedure and that is why I have not included the part where I dim variables. Thank you.
I am having trouble with my VBA code where I am supposed to clear contents of the entire column except the column header. The code I have so far only clears the column header and I am not sure how exactly to change it to help with my issue. P.S. this is part of a larger procedure and that is why I have not included the part where I dim variables. Thank you.
VBA Code:
lastcolumn = wb.Sheets(destinationSheetName).Cells(columnheader, Columns.count).End(xlToLeft).Column
For count = 1 To lastcolumn
If wb.Sheets(destinationSheetName).Cells(1, count).Value <> Workbooks(FileName).Sheets(importFile).Cells(1, count).Value Then
wb.Sheets(destinationSheetName).Cells(1, count).ClearContents
End If
Next count