Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have six cells and only one of those cells is colored and has data...
Example F G H I J K Y 1 blank blank data blank blank blank Copy cell that's not blank here 2 blank data blank blank blank blank Copy cell that's not blank here 3 blank blank blank blank blank data Copy cell that's not blank here ect. Is thier anyway to do this and to keep the cell color as well as the data? Thanks, DJ |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks crispbd
Not going to work as it copies what's in cell A to B I need something that will take the data and cell color to coulmn M let's say row 1, column a b c d e f are all blank except c... I need c copied to coulmn M.. next row, row 2, a,b,c,d,e,f are all blank except b.. I need b copied to coulmn M along with it's color... In other words I just want what ever data is in a-f coulmn and thier will only be one cell with data and colored on each row .. thanks for the help, dj "crispbd" wrote: This is very similar to using the if statement as a worksheet function except for the color aspect. From your post it looks as though you would like to copy the cell (and its interior fill color) that contains data to the adjacent column. A little For-Next loop macro would do the 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 :) -- crispbd ------------------------------------------------------------------------ crispbd's Profile: http://www.excelforum.com/member.php...o&userid=10880 View this thread: http://www.excelforum.com/showthread...hreadid=273665 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I copy a macro into another cell? | Excel Discussion (Misc queries) | |||
Is there a macro i can use to copy a cell +1 | Excel Discussion (Misc queries) | |||
Using macro to copy a part of a cell content to next cell | Excel Discussion (Misc queries) | |||
Macro help - copy a cell down | Excel Discussion (Misc queries) | |||
Macro Help to Copy to Last Cell | Excel Programming |