PDA

View Full Version : Changing Word cell back color by double clicking it



flagmino
08-17-2008, 04:15 AM
How can you write one sub that will change any back color cell of a doc by double clicking it?

flagmino
08-17-2008, 06:09 PM
I have a table in Word 2003. Some cells have a yellow background and some have a white background. If I select several cells for a cut and paste, how do I only get the yellow cells to be copied?

shamsam1
08-17-2008, 11:59 PM
Hi flamingo,

If (CurCell1.Value) = CurCell1.Interior.ColorIndex = 6 Then
"mention where to copy"

end if

or u can also use range to insted of "CurCell1.Value"

flagmino
08-18-2008, 12:08 AM
All the cells are part of one table.

shamsam1
08-18-2008, 12:22 AM
he want to copy yellow cells only..so code will work
Sub CopyColor()
Dim rReply As Range, rCell As Range
Dim lCol As Long

Set rReply = Application.InputBox _
(Prompt:="Selct a single cell that has the background color you wish to copy", Type:=8)

lCol = rReply.Interior.ColorIndex

For Each rCell In ActiveSheet.UsedRange
If rCell.Interior.ColorIndex = lCol Then
rCell.EntireRow.Copy Destination:=Sheet2.Range("A65536").End(xlUp)(2, 1)
'the above line was rcell.copy ans was changed to copy the entire row - AAE
End If
Next rCell

End Sub

flagmino
08-18-2008, 03:07 PM
I am studying Chinese. I have a table of 10 columns by 15 rows. Each cells holds a (master) Chinese character that will not change. The cell background color can either be yellow or white depending on if I successfully identified the character. I quickly end up with a table with only a few yellow cells. I want to select the whole table but only to have the yellow cells characters copied and paste into another application (TTS). The characters never change cells. Only the background color does indicating the characters I have left to study.