PootyToot
PootyToot

Reputation: 329

Excel VBA - Clear Column contents from row 2 down

I am trying to clear column contents from row 2 down on a VBA script which I am running, the piece of code below is how I am going about this.

This doesn't appear to be working, but no syntax issues or error messages. Are there issues with this code?

Option Compare Text
Option Explicit

Sub Loader()

Dim wb3 As Workbook
Set wb3 = ThisWorkbook

wb3.Worksheets("Config Sheet").Range("F2").End(xlDown).ClearContents

End Sub

Upvotes: 1

Views: 12754

Answers (1)

user4039065
user4039065

Reputation:

Try expanding the range to be more than just a single cell.

with wb3.Worksheets("Config Sheet")
    .Range("F2:F" & .range("F2").End(xlDown).row).ClearContents
end with

If you go to the Config Sheet worksheet, select F2 and tap Ctrl+, you will only have the last cell selected. The above modification is the same as if you had tapped Ctrl+Shift+.

Upvotes: 5

Related Questions