You are here:

- Home
- Computing/Technology
- Business Software
- Excel
- Continues...

Advertisement

Hi Tom, here is Thiago from the post:

(http://www.allexperts.com/user.cgi?m=6&catID=1059&expID=2697&qID=5095635)

the last post dont allow me to follow up the question.

So i will continue here..

I explained it wrong.

I will try to use an example.

I put in the cell F5 the value "D".

After that the cells G5, H5, I5, J5 and K5 will be filled with "X" and the cell K5 (the last) will be colored with green.

Until now you have already done this, but i need to erase the value that is on cell F5 and when i do this the cells erases and just the G5 keeps with the "X".

So i want that the macro save the result of the cell F5 independent if i erase that.

I'm attaching an image for a better explanation.

Thiago,

Assuming you will manually delete values in column F, then

I believe this will do what you want:

Private Sub Worksheet_Change(ByVal Target As Range)

Dim cell As Range, r As Range

Dim cellrr As Range, rr As Range

If Not Intersect(Target, Columns(6)) Is Nothing Then

Set rr = Intersect(Target, Columns(6))

Set r = Range("G4:R4")

For Each cellrr In rr ' change in column F

If cellrr.Row > 4 Then ' change is beyond row 4

If Len(Trim(cellrr)) <> 0 Then

If Application.CountIf(r, cellrr.Value) > 0 Then

With cellrr.Offset(0, 1).Resize(1, r.Columns.Count)

.Interior.ColorIndex = xlNone

.ClearContents

End With

For Each cell In r

Cells(cellrr.Row, cell.Column).Value = "x"

If UCase(cell.Value) = UCase(cellrr.Value) Then

Cells(cellrr.Row, cell.Column).Interior.ColorIndex = 14

Exit For

End If

Next

End If

End If

End If

Next

End If

End Sub

--

Regards,

Tom Ogilvy

- Add to this Answer
- Ask a Question

Rating(1-10) | Knowledgeability = 10 | Clarity of Response = 10 | Politeness = 10 |

Comment | Thanks a lot Tom, thats exactly what i want!!! |

This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

Excel

Answers by Expert:

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

Extensive experience. **Education/Credentials**

Master of Science (MS) degree Operations Research (ORSA)**Awards and Honors**

Microsoft MVP in Excel.