PDA

View Full Version : Solved: Copy format Range into another Range



kunguito
05-14-2008, 07:08 AM
I want the format of Range1 copied in Range2.
Assume they are the same size.

Private Sub CopiarFormato(ex As Excel.Application, Rg1 As Excel.Range, ByRef Rg2 As Excel.Range)
Rg1.Copy
Rg2.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
ex.CutCopyMode = False
End Sub

It doesn't work. Any suggestions?

Does anybody know the reason for:
ex.CutCopyMode = False

Thanks!

Bob Phillips
05-14-2008, 08:15 AM
In what does it not work?

That line is to get rid of the marching ants, but why are you passing the application to the procedure, just use

Application.CutCopyMode = False

kunguito
05-14-2008, 10:57 AM
Well, I'm generating an excel file from Access. I have to do some formating. Buff, it's tedious.
Since I declared an object variable of the application I guess I have to refer to Excel through it.

It doesn't cange the format.I'll debug it on my own. There mut be some other mistake.

What do you mean by "get rid of the ants"

Bob Phillips
05-14-2008, 11:17 AM
Go into Excel, select a cell, do copy (ctrl-C), there you will see the marching ants.

Simon Lloyd
05-14-2008, 10:40 PM
Lol, he means the animated dotted line around the cell that has been selected in the copy!