Hi all,
I am trying to change this code to clear the contents of the last column of my "Master sheet". I am having trouble indexing to the last column, however. I found this code online but it looks much more complicated than it needs to be. Is there any way to do this easier/change this code to fit my needs?
Right now, the letter of the column I want to delete pops up in a message box, but I'm not sure where to go from there. Any advice would be helpful and much appreciated!
Sub undoButton()
With Sheets("Master sheet")
Dim LastColumn As Integer
If WorksheetFunction.CountA(Cells) > 0 Then
LastColumn = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column
theRep = Replace(Cells(1, LastColumn).Address(False, False), "1", "")
MsgBox theRep
End If
End With
End Sub
Thanks.
Bookmarks