View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
rbel rbel is offline
external usenet poster
 
Posts: 2
Default Find blank cells and clear adjacent range


Indeed it does work - out of habit I had put it in a module.
Thank you

rbel

Where did you put the code at? If I right-click the worksheet tab (for
the sheet I want to run the code on) and select View Code from the
popup menu that appears, then copy/paste the code I posted into the
code-window that appears, then it works fine for me (I can either run
it directly within the VBA editor where you pasted the code or from the
worksheet itself by pressing Alt+F8).

Rick


"Robert" wrote in message
...

Rick - thanks for the code however it is producing an 'invalid use of
Me keyword' warning.



I think this should do what you want...

Sub ClearFiveRight()
Dim X As Long
For X = 1 To Me.UsedRange.Rows.Count
If Cells(X, "C").Value = "" Then
Cells(X, "C").Resize(1, 6).ClearContents
End If
Next
End Sub

Rick


"rbel" wrote in message
...

While I know how to find blank cells and delete complete rows, how
do I find all the blank cells in column C and clear the cell
contents of the next 5 cells to the right?

Grateful for some advice.
-- rbel