ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Coulmn Fields delete. (https://www.excelbanter.com/excel-programming/346502-coulmn-fields-delete.html)

shital shah

Coulmn Fields delete.
 
I have code were i am copy data from sheet1 to sheet2 with help of advance
filter. but after advance filter i want to delete some of the columns from
sheet2 (i.e. from report) But it's depend on the report want so is there any
way that what ever fields i have it will display on dialog box and i mark
that column fields which i want to delete from the report sheet and it will
delete that column from sheet.

Is this is possible any help thanks in advance.

Code is .....

Sub Reins()
Sheets("Sheet2").Select

Columns("a:az").Select
Selection.Delete

Sheets("Sheet2").Select
Sheets("Sheet1").Range("A4:AL26").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("Sheet1").Range("A1:AL2"),
CopyToRange:=Range("A1"), _
Unique:=False
End Sub

****al Shah

chijanzen

Coulmn Fields delete.
 
****al shah:

way that what ever fields i have it will display on dialog box and i mark
that column fields which i want to delete from the report sheet and it will
delete that column from sheet.


try,

Dim rng As Range
Set rng = Application.InputBox(prompt:="Please Select Range", Type:=8)
rng.EntireColumn.Delete

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"****al shah" wrote:

I have code were i am copy data from sheet1 to sheet2 with help of advance
filter. but after advance filter i want to delete some of the columns from
sheet2 (i.e. from report) But it's depend on the report want so is there any
way that what ever fields i have it will display on dialog box and i mark
that column fields which i want to delete from the report sheet and it will
delete that column from sheet.

Is this is possible any help thanks in advance.

Code is .....

Sub Reins()
Sheets("Sheet2").Select

Columns("a:az").Select
Selection.Delete

Sheets("Sheet2").Select
Sheets("Sheet1").Range("A4:AL26").AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=Sheets("Sheet1").Range("A1:AL2"),
CopyToRange:=Range("A1"), _
Unique:=False
End Sub

****al Shah



All times are GMT +1. The time now is 02:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com