Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would like to be able to delete columns in the Active Spreadsheed based on
cells in a Range (B2:IV2), where any cells containing #Value! or Grand Total would result in the column being deleted. I am using Excel 2000. Joel |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Joel,
You could do a macro: Sub DeleteColumns() Dim i As Integer For i = 256 To 1 Step -1 If Cells(1, i).Text = "#VALUE!" Or _ Cells(1, i).Text = "Grand Total" Then Cells(1, i).EntireColumn.Delete End If Next i End Sub HTH, Bernie MS Excel MVP "Joel Mills" wrote in message ... I would like to be able to delete columns in the Active Spreadsheed based on cells in a Range (B2:IV2), where any cells containing #Value! or Grand Total would result in the column being deleted. I am using Excel 2000. Joel |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub testerBBB()
Dim rng As Range, rng1 As Range On Error Resume Next Set rng = Range("B2:IV2").SpecialCells(xlFormulas, xlErrors) On Error GoTo 0 If Not rng Is Nothing Then rng.EntireColumn.Delete Do Set rng1 = Range("B2:IV2").Find("Grand Total", _ Lookat:=xlPart) If rng1 Is Nothing Then Exit Do rng1.EntireColumn.Delete Loop While True End Sub -- Regards, Tom Ogilvy "Joel Mills" wrote in message ... I would like to be able to delete columns in the Active Spreadsheed based on cells in a Range (B2:IV2), where any cells containing #Value! or Grand Total would result in the column being deleted. I am using Excel 2000. Joel |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Tom this work perfectly.
"Tom Ogilvy" wrote in message ... Sub testerBBB() Dim rng As Range, rng1 As Range On Error Resume Next Set rng = Range("B2:IV2").SpecialCells(xlFormulas, xlErrors) On Error GoTo 0 If Not rng Is Nothing Then rng.EntireColumn.Delete Do Set rng1 = Range("B2:IV2").Find("Grand Total", _ Lookat:=xlPart) If rng1 Is Nothing Then Exit Do rng1.EntireColumn.Delete Loop While True End Sub -- Regards, Tom Ogilvy "Joel Mills" wrote in message ... I would like to be able to delete columns in the Active Spreadsheed based on cells in a Range (B2:IV2), where any cells containing #Value! or Grand Total would result in the column being deleted. I am using Excel 2000. Joel |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Delete Rows based on condition | Excel Discussion (Misc queries) | |||
Delete row 1 based on condition in cell on row 2 | Excel Worksheet Functions | |||
Macro to delete rows based on a condition | Excel Worksheet Functions | |||
How to delete a data row based on a condition | New Users to Excel | |||
Is there a way to delete a cell value based on a condition? | Excel Discussion (Misc queries) |