View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Interesting macro needed

Hi ExcelBeginner,

Try:

'================
Public Sub Tester()
Dim WB As Workbook
Dim SH As Worksheet
Dim rng As Range
Dim rCell As Range

Set WB = Workbooks("MyBook.xls") '<<===== CHANGE
Set SH = WB.Sheets("Sheet1") '<<===== CHANGE

On Error Resume Next
Set rng = Intersect(SH.Columns(1), SH.UsedRange)
On Error GoTo 0

If Not rng Is Nothing Then
For Each rCell In rng.Cells
With rCell
If Not IsEmpty(.Value) Then
.Offset(0, 4).Resize(1, 15).Value = 0
End If
End With
Next rCell
End If
End Sub
'<<================


---
Regards,
Norman



"excelbeginner"
wrote in message
news:excelbeginner.25rchr_1144184142.461@excelforu m-nospam.com...

I need help creating a macro in excel that will fill Cols E - S with the
number zero for each row that has text in Col A.

something like this:

IF there is text in Cell A1 THEN fill Cells E1-S1 with zeros
IF there is text in Cell A2 THEN fill Cells E2-S2 with zeros
.. Until the Cell in Col A that has no text

thank you,


--
excelbeginner
------------------------------------------------------------------------
excelbeginner's Profile:
http://www.excelforum.com/member.php...o&userid=32228
View this thread: http://www.excelforum.com/showthread...hreadid=529799