Linking Cells & Cell COLOR

EverClear

New Member
Joined
Oct 23, 2012
Messages
32
Hi there!!

I am using a vlookup formula to pull data from one worksheet into another. The data in the source worksheet is also formatted (NOT conditional formatting). How can I pull not only the data, but also the *cell formatting* from the source worksheet into the destination worksheet??

I found some VBA code here on the website, but it doesn't seem to work for my project:
Sub Worksheet_Calculate()
'apply cells colors from single-cell formula dependencies/links

Dim Cel As Range
Dim RefCel As Range
On Error Resume Next

For Each Cel In ActiveSheet.UsedRange

If Cel.HasFormula Then
Set RefCel = Evaluate(Mid(Cel.Formula, 2))
Cel.Interior.Color = RefCel.Interior.Color
End If

Next Cel

End Sub

Thanks for your help!!
Shawn
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
sure! I placed the code in the destination worksheet's code module. here's an example of the vlookup formula i am using in the destination worksheet:

VLOOKUP($D$3,'FY14 KaBoom 5.30.13'!$B$80:$O$89,D15,FALSE)

So - the formula looks up a value in the source worksheet (KaBoom 5.30.13), and if it finds it, the value is returned. But the formatting isn't.
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,871
Members
449,054
Latest member
juliecooper255

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top