View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Delete Columns if rows 8 & 9 are blank and place border

Sorry, I can't visualize what you want - but your working with Roger anyway,
so no use me getting in the way.

--
Regards,
Tom Ogilvy


"manfareed" wrote:

Hi Tom,

This works but causes another problem.When deleting the columns it deletes
some of the headings which are in rows 6+7. Would it be possible to copy the
row headings from rows 6+7 to the next "blank" column to the right i.e. it
contains data in rows 7 to 9 but has no heading detail in rows 6+7.

It follows that if there are 2 blanks columns after the row heading then it
should be copied to the next to these blank cells. Eg if "Birmingham" row 6
and "060300" is row 7is in column E and F&G are blank then it should be
copied to F&G.

Thanks,

Manir



"Tom Ogilvy" wrote:

Test this on a copy of your sheet.

Sub cleansheet()
Dim j As Long, i As Long
j = 0
For i = 256 To 5 Step -1
If Application.CountA(Cells(8, i).Resize(2, 1)) = 0 Then
Columns(i).EntireColumn.Delete
Else
j = j + 1
End If
Next
ActiveSheet.UsedRange
With Cells(6, 1).Resize(5, 4 + j)
.BorderAround Weight:=xlThick
End With

--
Regards,
Tom Ogilvy


End Sub"manfareed" wrote:

Hi

I wish to delete columns from column "E" onwards which have no value on rows
8 and 9. Also I would like to place a "thick box border" around rows 6 to 10
up to the and including the last column with data.

Thanks