Muhammad Haroon
Muhammad Haroon

Reputation: 284

VBA delete columns based on selected cell

I want to delete 4 columns before Active cell but i don't know which cell the user will select. I mean if the Active cell is "H3" then i will delete (D,E,F,G) entire columns. any help will be appreciated.

Upvotes: 0

Views: 1268

Answers (1)

shahkalpesh
shahkalpesh

Reputation: 33474

range(activecell.Offset(ColumnOffset:=-1),activecell.Offset(ColumnOffset:=-4)).Columns.Delete

Try this out on a sample sheet before putting it to use.

Upvotes: 2

Related Questions