New Excel Forum

This forum has been moved to TeachExcel.com

Ask all future questions in the New Excel Forum.

ExcelKey

copy color of cell VBA

Macros, VBA, Excel Automation, etc.

copy color of cell VBA

Postby Rafa88 » Tue Jun 28, 2016 2:43 pm

Hi, anyone know how to copy the colors of different cells in range to another range of cells?
eg how to copy the colors in f3: f6 to range in d3:d6 ? :?

Thanks in advance!
  • 0

Rafa88
Rookie
 
Posts: 1
Joined: Jun 28, 2016
Reputation: 0
Excel Version: Excel 2010

Re: copy color of cell VBA

Postby NoSparks » Tue Jun 28, 2016 3:47 pm

You need to use .pastespecial

Put this in a module
Code: Select all
Sub Test()

Range("F3:F6").Copy
With Range("D3:D6")
    .PasteSpecial xlPasteFormats
    .PasteSpecial xlPasteValues
End With
   
End Sub

put your cursor on pastespecial and hit F1
then click on xlPasteType to see what's available.
  • 0

NoSparks
Excel Hobbyist
 
Posts: 637
Joined: May 28, 2014
Reputation: 103
Excel Version: 2010


Return to Macros and VBA Questions

Who is online

Users browsing this forum: No registered users and 81 guests

cron