delete columns

hendrikbez

Board Regular
Joined
Dec 13, 2013
Messages
95
Office Version
  1. 2021
Platform
  1. Windows
I am trying to delete columns from one of my sheets, but cannot get it to delete, I have tried with sheet6 and insert(sheet name)

I have put a button on sheet5 t5o delete columns on sheet6(Insert), but it is not working

VBA Code:
Sub Del_columns()
 Dim sourceSheet As Worksheet
 Set sourceSheet = Sheet6
 sourceSheet.Columns("H:Z").EntireColumn.Delete
 End Sub

Code:
Sub Del_columns()
 Dim sourceSheet As Worksheet
 Set sourceSheet = Insert
 sourceSheet.Columns("H:Z").EntireColumn.Delete
 End Sub
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
I got it to work, I did make a mistake in one words spelling
 
Upvote 0
Ok, what happens if you try this
VBA Code:
Sub Del_columns()
    MsgBox Evaluate("isref(Insert!A1)")
    Sheet6.Range("H:Z").EntireColumn.Delete
End Sub
Do you get the message box, and what does it say?
 
Upvote 0
Glad you sorted it & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,143
Messages
6,123,276
Members
449,093
Latest member
Vincent Khandagale

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top