Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have following file. i need to delete unwanted colomns and colomn. ================================================== ================= Item Feb1 Feb2 and so on Qty Amt Dep COST COGS Qty Amt Dep Cost COGS cup 1 3 3 234 23 4 4 3 234 23 coffee 2 5 3 23 56 5 2 3 234 23 paper 3 2 3 23 56 7 8 3 234 23 ================================================== ================= Important Each col except "item" contains sub- colomns (i.e Qty Amount %ofDep AvgCost COGS AvgCOGS). I need to keep col name Item. I need to keep col name Qty and Amount. I want to delete all other colomns i.e Amt, Dep,Cost, COGS, There are ALSO several blank titles colomns also which i want to delete. Required file ================================================== ================= Item Feb1 Feb2 Feb3 and so on. Qty Amount Qty Amount Qty Amount cup 1 3 4 4 2 3 coffee 2 5 5 2 4 3 paper 3 2 7 8 5 3 ================================================== ================= I am looking for macro for that. Any advice would be highly appreciated thanks in advance for reading above and solution. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
Your question is a bit amigious. Looking at your data Column Amt in first table seems to be Amount column in result table. Try this and change Amt to Amount if required. Sub RemoveColumns() targetRow = 2 LastCol = Cells(targetRow, Columns.Count).End(xlToLeft).Column For c = LastCol To 2 Step -1 If Cells(targetRow, c).Value < "Qty" And Cells(targetRow, c).Value < "Amt" Then Columns(c).Delete End If Next End Sub Best regards, Per "mshak" skrev i meddelelsen ... Hi, I have following file. i need to delete unwanted colomns and colomn. ================================================== ================= Item Feb1 Feb2 and so on Qty Amt Dep COST COGS Qty Amt Dep Cost COGS cup 1 3 3 234 23 4 4 3 234 23 coffee 2 5 3 23 56 5 2 3 234 23 paper 3 2 3 23 56 7 8 3 234 23 ================================================== ================= Important Each col except "item" contains sub- colomns (i.e Qty Amount %ofDep AvgCost COGS AvgCOGS). I need to keep col name Item. I need to keep col name Qty and Amount. I want to delete all other colomns i.e Amt, Dep,Cost, COGS, There are ALSO several blank titles colomns also which i want to delete. Required file ================================================== ================= Item Feb1 Feb2 Feb3 and so on. Qty Amount Qty Amount Qty Amount cup 1 3 4 4 2 3 coffee 2 5 5 2 4 3 paper 3 2 7 8 5 3 ================================================== ================= I am looking for macro for that. Any advice would be highly appreciated thanks in advance for reading above and solution. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
macro to keep specific name colomns and delete all others | Excel Discussion (Misc queries) | |||
delete unwanted colomns, empty colomns | Excel Programming | |||
macro to delete unwanted data | Excel Discussion (Misc queries) | |||
Macro to delete unwanted sheets | Excel Discussion (Misc queries) | |||
I need a macro to delete unwanted data | Excel Programming |