Formatted cells turning up in column IV

K

Kanga 85

If I remove a Column:

Columns ("B:B").Delete Shift:=xlToLeft,

I find that column IV (the last column in the spreadsheet) turns up with a
formatted cell (IV3) with a Border.Linestyle.

If I then try to insert a Column:

Columns ("B:B").Insert Shift:=xlToRight,

I get the error message "To prevent possible loss of Data Microsoft Excel
cannot shift nonblank cells off the worksheet...."

I can obviously go to Range "IV3" and clear the formatting, but that seems
tedious. How do I ensure that I get a blank column IV when I delete a
column elsewhere in a spreadsheet, and why does this formatted column appear
when I might have expected a totally blank new column?

Thanks for any help/advice.
 
N

NickHK

I cannot repeat your error with Excel2002.
Maybe you have some code doing this that you have forgotten/missed ?

NickHK
 
D

Dave Peterson

If you open excel in safe mode

Windows start button|Run
type:
excel /safe

And then file|open your workbook

Then test it, what happens?
 
K

Kanga 85

If anyone else is interested or curious about this problem, I am happy to
email them one sheet of the offending workbook.

Kanga 85 said:
Thanks Dave,
I appreciate that is difficult to solve a problem of this sort when you
cannot duplicate it on your machine.

It seems that somehow I have instructed that newly-inserted columns must not
be blank. I can work around it with a:
Range("IV") .Borders.LineStyle = xlNone
in my code, but this seems an ugly patch and its a pain because it has to be
included for each of the worksheets I operate on within the Workbook.

Thanks anyway.
 
N

NickHK

Well, I can't say why Excel is creating this border; some glitch in the WS I
suppose.
It seems that the line is an xlInsideHorizontal, but how you create one of
those is beyond me; I can only add a xlEdgeBottom ???
But you can permenantly get rid of it with this:

Private Sub CommandButton1_Click()
'Create a border line, so there is something to change
Columns("IU:IU").Delete Shift:=xlToLeft

'Change the borders
With Rows("46:47")
.Borders(xlInsideHorizontal).LineStyle = xlNone
' .Borders(xlEdgeBottom).LineStyle = xlNone
End With

'Test
Columns("IU:IU").Delete Shift:=xlToLeft

End Sub

NickHK
 
K

Kanga 85

Thanks Nick

NickHK" wrote:
Well, I can't say why Excel is creating this border; some glitch in the WS I
suppose.
It seems that the line is an xlInsideHorizontal, but how you create one of
those is beyond me; I can only add a xlEdgeBottom ???
But you can permenantly get rid of it with this:

Private Sub CommandButton1_Click()
'Create a border line, so there is something to change
Columns("IU:IU").Delete Shift:=xlToLeft

'Change the borders
With Rows("46:47")
.Borders(xlInsideHorizontal).LineStyle = xlNone
' .Borders(xlEdgeBottom).LineStyle = xlNone
End With

'Test
Columns("IU:IU").Delete Shift:=xlToLeft

End Sub

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top