Have a spreadsheet that grows horizontal with a commandbutton. I need to delete the values of the last two cells everytime I do this and am having trouble selecting them to do so. Here is the code I have been working with:
Dim mylayeronea, mylayeroneb As String
mylayeronea = Cells(30, Columns.Count).End(xlToLeft).Offset(0, -1).Address
mylayeroneb = Cells(30, Columns.Count).End(xlToLeft).Address
ActiveSheet.Range(mylayeronea & mylayeroneb).Select
Selection.Delete
mylayeronea and mylayeroneb are selecting the correct cells so that is not the problem. Anyone know why I am unable to do this?
Thanks
Dim mylayeronea, mylayeroneb As String
mylayeronea = Cells(30, Columns.Count).End(xlToLeft).Offset(0, -1).Address
mylayeroneb = Cells(30, Columns.Count).End(xlToLeft).Address
ActiveSheet.Range(mylayeronea & mylayeroneb).Select
Selection.Delete
mylayeronea and mylayeroneb are selecting the correct cells so that is not the problem. Anyone know why I am unable to do this?
Thanks