Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / April 2007

Tip: Looking for answers? Try searching our database.

Transfer background color when necessary

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
smandula - 29 Apr 2007 11:43 GMT
In this macro, How do you include the background color format?
Color is on Sheet 2, would like to have it carried across to sheet 1
along with data. Any color, but I am using color 4(green).
The Cells being copied to Sheet1 is not always colored, there are
uncolored ones being copied. Sheet 2 has 6 columns with numbers
from 1 to 47. Whereas, Sheet 1 has 47 coloumns waiting to receive
each of the 6 individual numbers. It's a matter of transferring color
for those cells which are colored.
This request has been posted elsewhere, with no solution.
----------------------------------------------
Sub Newer2() 'Final Code
Dim rCell As Range
Dim rCell2 As Range

For Each rCell2 In Sheet2.Range("A2:A150") 'adjust for how many rows
you want to copy
   With Sheet1.Range(rCell2.Offset(0, 0).Address) 'Header row has
description row one
       .Value = rCell2.Value
       For Each rCell In rCell2.Offset(0, 1).Resize(1, 8) 'change all
the columns you need
              .Offset(0, rCell.Value).Value = rCell.Value
       Next rCell
    End With
Next rCell2
End Sub
------------------------------------------------
With Thanks
Dave Peterson - 29 Apr 2007 13:25 GMT
Maybe you could copy|paste and bring over all the formatting?

.Offset(0, rCell.Value).Value = rCell.Value
becomes
rcell.copy _
 destination:=.Offset(0, rCell.Value)

> In this macro, How do you include the background color format?
> Color is on Sheet 2, would like to have it carried across to sheet 1
[quoted text clipped - 24 lines]
> ------------------------------------------------
> With Thanks

Signature

Dave Peterson

smandula - 29 Apr 2007 18:06 GMT
Thanks very much,   Dave Peterson, for such an elegant
solution. I didn't know where to begin. I was considering
pasteSpecial to no avail.

I works like a charm.

Many Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.