mpeters102
New Member
- Joined
- Mar 14, 2009
- Messages
- 10
Hello All,
This is my first post so If I am missing any details please let me know.
I have a spreadsheet where I sum the total of all the rows below a certain cell, I do so for about 80 columns. I would like to write a marco which deletes the entire column if that sum = 0
I have the below written, but it does not work in every circumstance it seems to pick random columns to delete...I need a better way to do this please help!!
Dim Cusips As Range
Dim NumCusips As Integer
Dim Col As Integer
Sheets("Corp").Select
Range("FirstCorpCell").Select
Range(Selection, Selection.End(xlToRight)).Select
Set Cusips = Selection
NumCusips = Cusips.Count
For Col = 4 To (NumCusips + 3) Step 1
If Cells(9, Col).Value < 1 Then Columns(Col).EntireColumn.Delete
Next Col
This is my first post so If I am missing any details please let me know.
I have a spreadsheet where I sum the total of all the rows below a certain cell, I do so for about 80 columns. I would like to write a marco which deletes the entire column if that sum = 0
I have the below written, but it does not work in every circumstance it seems to pick random columns to delete...I need a better way to do this please help!!
Dim Cusips As Range
Dim NumCusips As Integer
Dim Col As Integer
Sheets("Corp").Select
Range("FirstCorpCell").Select
Range(Selection, Selection.End(xlToRight)).Select
Set Cusips = Selection
NumCusips = Cusips.Count
For Col = 4 To (NumCusips + 3) Step 1
If Cells(9, Col).Value < 1 Then Columns(Col).EntireColumn.Delete
Next Col