Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Search & Replace

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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
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.


.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Search & Replace

John,

Did you try activecell.value = "Ok" after the find?

Charle

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Search & Replace


Charles, no, and since I am still learning vba, can you
enlighten me as to the advantage of doing so vs my specifc
cell reference?

John
-----Original Message-----
John,

Did you try activecell.value = "Ok" after the find?

Charles


---
Message posted from http://www.ExcelForum.com/

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Search & Replace

John,

I ran your code and it replaced "john" with Ok.
As to why when you run your end of it doesn't work I can't really say
why its not working. If you want send your worksheet to me at
and I'll look it over.

Charles


---
Message posted from
http://www.ExcelForum.com/

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search and Replace, or Add New Row GEdwards Excel Discussion (Misc queries) 1 April 21st 10 08:20 AM
Search and replace CatPEG Excel Discussion (Misc queries) 4 January 7th 08 04:31 AM
Search and Replace Abdul Excel Discussion (Misc queries) 2 March 23rd 06 02:38 PM
Search and replace Subu Excel Worksheet Functions 4 June 9th 05 07:01 PM
Search and Replace Rebecca New Users to Excel 3 February 27th 05 09:29 PM


All times are GMT +1. The time now is 04:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"