Hi all,
Apologies for the simple request as a beginner to the forum, but I would like to have a button on a spreadsheet that I can delete either a specific column or row.
I have code to remove a column as follows:
Sub DeleteColumns()
Dim varUserInput As Variant
varUserInput = InputBox("Enter Column Letter where you want to delete a column:", _
"What Column?")
If varUserInput = "" Then Exit Sub
Columns(varUserInput).Delete
Exit Sub
M:
MsgBox "You did not enter a letter character into the InputBox" & vbNewLine & "Try again"
End Sub
Basically I would like a button to delete a row or alternatively, a button to delete either a row or column.
I appreciate any feedback for the same.
Kind regards,
Sean
Apologies for the simple request as a beginner to the forum, but I would like to have a button on a spreadsheet that I can delete either a specific column or row.
I have code to remove a column as follows:
Sub DeleteColumns()
Dim varUserInput As Variant
varUserInput = InputBox("Enter Column Letter where you want to delete a column:", _
"What Column?")
If varUserInput = "" Then Exit Sub
Columns(varUserInput).Delete
Exit Sub
M:
MsgBox "You did not enter a letter character into the InputBox" & vbNewLine & "Try again"
End Sub
Basically I would like a button to delete a row or alternatively, a button to delete either a row or column.
I appreciate any feedback for the same.
Kind regards,
Sean