Macro to delete certain cells
Sub ClearG()
lastrow = Cells(Rows.Count, "F").End(xlUp).Row
For r = 2 To lastrow
If Cells(r, "F") < "" Then Cells(r, "G") = ""
Next
End Sub
"Chris_t_2k5" wrote:
Hi Within my spreadsheet I have columns F and G populated with different text
eg.
F G
HVKHC UIGIUG
UGIUGGUI
OIHIH
IUGIUG 9YHIH
What I require is a macro that will clear cell G if the corresponding cell F
is not blank. So looking at the top row I want to keep HVKHC in column F but
clear UIGIUG in column G. Looking at rows 2 and 3 no action should be done.
It is important that column G is cleared and not fully deleted as I have
data past column G.
Any ideas?
Thanks in advance
|