arun_roy
arun_roy

Reputation: 601

How to Copy the one Cell Format to the all the Cells beside that Cell?

Could you guide me by saying that How can i Copy the color and Font and Style of an Cell say in Row#1? But not the content of the Cell.I wrote the below code but it gets copied all the above with First Cell data,which I wouldn't expect.

        ob3.Range("A1").Copy
    ob3.Range("A1").EntireRow.PasteSpecial(-4163) 'xlValues

Please guide here!

Thanks,

Upvotes: 0

Views: 258

Answers (1)

bonCodigo
bonCodigo

Reputation: 14361

Try the follwing:

ob3.Range("A1").Copy 
ob3.Range("A1").EntireRow.PasteSpecial (xlPasteFormats) 
Application.CutCopyMode = False 

I see Scott's point here :) Either you could set the number itself or use a const to use this formattig via your sheet.

Const xlPasteFormats = -4122 
Const xlPasteValues = -4163

ob3.Range("A1").Copy
ob3.Range("A1").EntireRow.PasteSpecial xlPasteFormats

Upvotes: 1

Related Questions