Disappearing grid lines

O

Otto Moehrbach

Excel XP, Win XP
I am copying a series of cells in a For loop and pasting them somewhere
else. The destination cells have the normal grid lines and no borders. The
source cells have borders around each cell. I am using the following code:
j.Copy
Dest.Offset(cc).PasteSpecial xlPasteValues

After pasting, the destination cells have no grid lines. Why? And how do I
get the grid lines back? Thanks for your time. Otto
PS: I am helping an OP with this file that he built. He has a MAC and I
have a PC. Could this be a factor?
 
D

Don Guillett

try this instead of copy/paste
sheets("destinationsheet").range("d2:f3").value=
sheets("sourcesheet1").range("a1:c2").value=

note that the ranges need not be identical but they must be the same size.
 
D

Die_Another_Day

Because you told Excel not to. (xlPasteValues) use xlPasteAll to get
the borders.

Die_Another_Day
 
O

Otto Moehrbach

Don
I'll try that and let you know. But in the meantime, how do I get the
grid lines back? Remember that grid lines are gone for only the destination
cells, not the whole sheet. Thanks for your time. Otto
 
O

Otto Moehrbach

Thanks for the help but I think you misunderstood me. I want to copy only
the values, so I used the "xlPasteValues". This didn't copy the borders and
that's what I wanted. But now the grid lines around the destination cells
are gone. Not the borders but the normal sheet grid lines. Thanks again.
Otto
 
O

Otto Moehrbach

Don
I tried a slight variation of what you said to match what I have. The
line of code is now:
Dest.Offset(cc).Value = j.Value
I changed the destination to a group of cells that I knew had grid lines.
Now those grid lines are gone as well. Any ideas? Thanks for your time.
Otto
 
D

Don Guillett

d5 with borders
d6 standard grid lines stayed intact

Range("d6").Value = Range("d5").Value
just tested and it did NOT copy the borders or delete the normal grid lines
 
P

Peter T

If the copied cell's interior format has a pattern (eg Solid) when you paste
you will lose gridlines to cell neighbours. It might not be obvious if the
copied cell's interior colour is white or xlAutomatic. Borders may or may
not get pasted, depends where the borders were originally applied. Eg bottom
border applied to A1, copy & paste A2 > no top border in the destination,
and no top gridline if say Solid.

Regards,
Peter T
 
O

Otto Moehrbach

Don
I get the same thing you do with any of my files, old and new. The
problem is that the grid lines disappear on the OP's file. And not in all
cells. Just cells in a certain group of rows. He built his file on a MAC.
I know you feel the same as I do; frustrated.
I think I will try deleting all the rows in this group of rows. In
fact, I'll delete all the rows from the start of this group of rows down to
the bottom. Thanks for your time. Otto
 
O

Otto Moehrbach

Peter
Bingo!!! You are spot on! Every cell I was copying had a while
pattern. The OP did this to get a specific appearance. I will tell him how
to do that without the white pattern. Thanks for your time. Otto
 
O

Otto Moehrbach

Change "while" to "white". One of these days I'm going to learn how to
spell. Otto
 

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