View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
john john is offline
external usenet poster
 
Posts: 97
Default Search & Replace


Sub Macro1()
'
' Macro1 Macro
'
Sheets("data").Select
' count the number of days (in row 1) and the number
'of rows of data (in row 2 on)
ndays = WorksheetFunction.CountA(Range("a1:ia1"))
nRows = WorksheetFunction.CountA(Range("a1:a1000"))
For i = 1 To ndays
If Cells(1, i).Value < "Fri" Then GoTo nexti
For j = 2 To nRows
If Cells(j, i).Value = "John" Then Cells(j, i).Value = "OK"
Next j
nexti:
Next i
'
End Sub


John

-----Original Message-----
I have a Calender worksheet, I need the macro to search

row 1 (days
Mon-Fri), find only the Fridays, then search down the

column until it finds
a name (John), then put "OK" into the corresponding cell?

I wrote one where
searches each row & column by using "next". However, its

not changing the
corresponding cell value.


.