Our Recommendation for You Search your Query, You can find easily. for example search by book name or course name or any other which is related to your education

Followers

Select and delete specific Excel Columns and Rows

Select and delete specific or certain multiple Columns or Rows via VBA in Excel


Selecting certain columns using VBA macro


VBA macro below selects certain columns on the Sheet1 defined range. This VBA macro copy into Module1  of your Excel files. When you start the VBA macro on Sheet1 will be selected columns A, B, E, F and G.

Sub SelectColumns1()
'select specific columns A, B, E, F and G
Application.DisplayAlerts = False
With Sheet1
Range("A:B,E:G").Select 'select specific columns A, B, E, F and G
End With
Application.DisplayAlerts = True
End Sub


After starting the VBA macros have the following situation at Sheet1 in which they have been selected certain non-adjacent columns.

Select certain non adjacent columns using VBA in Excel

Selects some columns in Excel using VBA


All VBA macros below return the same result as shown above. Therefore, selected by specific or certain columns on Sheet1. You notice different ways VBA commands for selecting columns.

Sub SelectSpecificColumns2()
'select specific columns with union range
Application.DisplayAlerts = False
With Sheet1Application.Union(Range("A1"), Range("B1"), Range("E1"), Range("F1"), Range("G1")).EntireColumn.Select 'select certain columns
End With
Application.DisplayAlerts = True
End Sub

Sub SelectSpecificColumns3()
'select specific columns with range
Application.DisplayAlerts = False
With Sheet1
Range("A1,B1,E1,F1,G1").EntireColumn.Select 'select certain columns
End With
Application.DisplayAlerts = True
End Sub

Sub SelectSpecificColumns4()
'select specific columns with union
Application.DisplayAlerts = False
With Sheet1
Application.Union(Columns("A"), Columns("B"), Columns("E"), Columns("F"), Columns("G")).Select 'select certain columns
End With
Application.DisplayAlerts = True
End Sub

Selecting multiple adjacent columns in a range Excel data

If you need to select a certain group of columns that are in the series then use VBA macro below. This VBA macro selects all the columns in Sheet1. This VBA macro copy in to Module1 of your Excel files.

Sub SelectSpecificColumnsRange5()
'Select specific adjacent columns 2,3,4,5,6 and 7
With Sheet1
'".Delete" instead ".Select" for delete columns
.Range(.Cells(1, 2), .Cells(1, 7)).EntireColumn.Select 'select columns from 2 to 7 or
End With
End Sub

Select a series or group of adjacent columns in Excel via VBA

Delete of specific columns in Excel using VBA

If you want to delete specific or certain columns in Excel, then use this VBA macro below. The particular VBA macro deletes columns 2,3 and 7 on Sheet1. This VBA macro, copy in the Module 1 of your Excel files.

Sub DeleteCertainColumns6()
'delete specific columns 2,3 and 7 on Sheet1
Dim Rng As Range
With Sheet1
Set Rng = Union(.Columns(2), .Columns(3), .Columns(7)) 'specific columns on sheet1
End With
Rng.Delete Shift:=xlToLeft 'deleting specific columns and displacement columns from right to left
'Rng.Select 'if you want select certain columns then use this command line
End Sub

Select and remove specific columns and rows in Excel

If you need to delete certain columns and rows in a range Excel spreadsheet, then use one of the VBA macros shown below. All macros return the same result. You see the differences in the VBA commands. The first and second shows the VBA macro was recorded using the Record Macro commands in the VBE.

Select and delete specific rows and columns in Excel using VBA macros.
Sub Macro1()
'recorded VBA macro in Excel
'select and delete specific columns and rows on Sheet1

Sheets("Sheet1").Select
Range("B:B,H:H").Select 'select specific columns B and H on sheet1
Range("H1").Activate
Selection.Delete Shift:=xlToLeft 'deleting rows and displacement columns right to left
Rows("10:12").Select 'select specific rows from 10 to 12 on sheet1
Selection.Delete Shift:=xlUp 'deleting rows and displacement rows below to up
Range("A1").Select
End Sub

Sub Macro2()
'recorded VBA macro in Excel
'select and delete specific columns and rows on Sheet1

Sheets("Sheet1").Select
Range("B:B,H:H").Select 'select specific columns B and H on sheet1
Range("H1").Activate
Selection.Delete Shift:=xlToLeft 'deleting rows and displacement columns right to left
Range("10:10,11:11,14:14").Select 'select specific rows from 10,11 and 14 on sheet1
Range("A14").Activate
Selection.Delete Shift:=xlUp 'deleting rows and displacement rows below to up
Range("A1").Select
End Sub

Sub SelectAndDeleteCertainColumns2()
'select and delete specific columns and rows on Sheet1
Application.DisplayAlerts = False
With Worksheets("Sheet1")
Range("10:10, 11:11, 12:12").Select 'select specific rows on sheet1
Selection.Delete Shift:=xlUp 'deleting rows and displacement rows below to up
Range("B:B, H:H").Select 'select specific columns on sheet1
Selection.Delete Shift:=xlToLeft 'deleting rows and displacement columns right to left
End With
Application.DisplayAlerts = True
End Sub

Sub SelectDeleteSpecificRowsColumns3()
'select and delete certain rows and columns on Sheet1
Application.DisplayAlerts = False
With Sheet1
Range("10:10, 11:11, 12:12").EntireRow.Delete 'select and delete specific rows 10,11, and 12
Range("B:B, H:H").EntireColumn.Delete 'select and delete specific columns B and H
End With
Application.DisplayAlerts = True
End Sub


Source: Internet network. All the merits of the authors mentioned VBA macros.