View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
crispbd[_4_] crispbd[_4_] is offline
external usenet poster
 
Posts: 1
Default 6 cell copy macro


This is very similar to using the if statement as a worksheet functio
except for the color aspect. From your post it looks as though yo
would like to copy the cell (and its interior fill color) that contain
data to the adjacent column. A little For-Next loop macro would do th
trick, here's an example:

Sub BringData
'define the range to consider in the loop
' here we choose the first cell for the first three rows:
Dim Counter as Integer

For Counter = 1 to 3

If Cells(Counter,1).value < "" then
Cells(Counter,2).Value = Cells(Counter,1).Value

Cells(Counter,2).Interior.ColorIndex=Cells(Counter ,1).Interior.ColorIndex
Else
Cells(Counter,2).Interior.ColorIndex=2
End If

Next Counter

:

--
crispb
-----------------------------------------------------------------------
crispbd's Profile: http://www.excelforum.com/member.php...fo&userid=1088
View this thread: http://www.excelforum.com/showthread.php?threadid=27366