Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ST ST is offline
external usenet poster
 
Posts: 14
Default Using code to mimic a find and replace

Hi,
I have two worksheets, one holds data horizontally for course codes,
vertivcally for peoples names, the cells have a y or N to indicate if the
course is requred, the second sheet holds the same data drawn from a database
with the addition of a date (i.e if the peson has attended the course) This
first sheet is regularly refreshed.

I would like to be able to take the date from the first sheet and find the
same person and code on the second sheet and replace if a y is present with
the date, if the y is not present then replace with the date and change the
cell colour.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Using code to mimic a find and replace

Off the top, untested

With Worksheets("Sheet2")
iLastRow = .Cells(.Rows.Count,"A").End(xlUp).Row
iLastCol = .Cells(1,.Columns.Count).End(xlToLeft).Column
For Each cell In .Range("B2",.Cells(iLastRow, iLastCol)
If IsDate(cell.Value) Then
Worksheets("Sheet1").Range(cell.Address).Vaue = _
cell.Value
End If
Next cell

--

HTH

RP
(remove nothere from the email address if mailing direct)


"ST" wrote in message
...
Hi,
I have two worksheets, one holds data horizontally for course codes,
vertivcally for peoples names, the cells have a y or N to indicate if the
course is requred, the second sheet holds the same data drawn from a

database
with the addition of a date (i.e if the peson has attended the course)

This
first sheet is regularly refreshed.

I would like to be able to take the date from the first sheet and find the
same person and code on the second sheet and replace if a y is present

with
the date, if the y is not present then replace with the date and change

the
cell colour.



  #3   Report Post  
Posted to microsoft.public.excel.programming
ST ST is offline
external usenet poster
 
Posts: 14
Default Using code to mimic a find and replace

Bob, Thanks I am getting a syntax error on the following line, any clues

For Each cell In .Range("B2",.Cells(iLastRow, iLastCol)

"Bob Phillips" wrote:

Off the top, untested

With Worksheets("Sheet2")
iLastRow = .Cells(.Rows.Count,"A").End(xlUp).Row
iLastCol = .Cells(1,.Columns.Count).End(xlToLeft).Column
For Each cell In .Range("B2",.Cells(iLastRow, iLastCol)
If IsDate(cell.Value) Then
Worksheets("Sheet1").Range(cell.Address).Vaue = _
cell.Value
End If
Next cell

--

HTH

RP
(remove nothere from the email address if mailing direct)


"ST" wrote in message
...
Hi,
I have two worksheets, one holds data horizontally for course codes,
vertivcally for peoples names, the cells have a y or N to indicate if the
course is requred, the second sheet holds the same data drawn from a

database
with the addition of a date (i.e if the peson has attended the course)

This
first sheet is regularly refreshed.

I would like to be able to take the date from the first sheet and find the
same person and code on the second sheet and replace if a y is present

with
the date, if the y is not present then replace with the date and change

the
cell colour.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Using code to mimic a find and replace

Missing parentheses at end...
For Each cell In .Range("B2",.Cells(iLastRow, iLastCol))

Mike F

"ST" wrote in message
...
Bob, Thanks I am getting a syntax error on the following line, any clues

For Each cell In .Range("B2",.Cells(iLastRow, iLastCol)

"Bob Phillips" wrote:

Off the top, untested

With Worksheets("Sheet2")
iLastRow = .Cells(.Rows.Count,"A").End(xlUp).Row
iLastCol = .Cells(1,.Columns.Count).End(xlToLeft).Column
For Each cell In .Range("B2",.Cells(iLastRow, iLastCol)
If IsDate(cell.Value) Then
Worksheets("Sheet1").Range(cell.Address).Vaue = _
cell.Value
End If
Next cell

--

HTH

RP
(remove nothere from the email address if mailing direct)


"ST" wrote in message
...
Hi,
I have two worksheets, one holds data horizontally for course codes,
vertivcally for peoples names, the cells have a y or N to indicate if
the
course is requred, the second sheet holds the same data drawn from a

database
with the addition of a date (i.e if the peson has attended the course)

This
first sheet is regularly refreshed.

I would like to be able to take the date from the first sheet and find
the
same person and code on the second sheet and replace if a y is present

with
the date, if the y is not present then replace with the date and
change

the
cell colour.






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
Tidy up multiple find and replace code PSM[_10_] Excel Worksheet Functions 2 April 6th 09 02:00 PM
find and replace - replace data in rows to separated by commas msdker Excel Worksheet Functions 1 April 15th 06 01:00 AM
Find and Replace code in Sheet modules Jon Excel Programming 10 March 29th 05 10:15 PM
Code to mimic vlookup Mark Excel Programming 0 March 29th 05 07:21 PM
[URGENT]How to mimic the toolbar zoom button from code Umberto Giacobbi[_2_] Excel Programming 1 August 12th 04 03:31 PM


All times are GMT +1. The time now is 08:43 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"