Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Macro to add text to cell

Hi,

I browsed through all the other posts before posting this. I was hoping it
would be a easy macro, but it doesn't appear to be so I thank anyone that
helps in advance.

What I need is a Macro that will do the following:

1. Look at the data in each cell of Range X6:x361
2. Find "IP/OP Obs"
3. Enter "No IP acuity documented; should have been OP Observation" into the
corresponding cell for that row in column BK

And I need it to loop continuously. In addition I need to prevent the macro
from giving me an error when it comes to a blank cell.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Macro to add text to cell

Hi,

Right click your sheet tab, view code and paste the code below in and run
it. Running it all the time isn't practical but you could run it every n
seconds/minutes and to do this have a look at ontime here.

http://www.ozgrid.com/Excel/run-macro-on-time.htm

Sub Sonic()
For Each c In Range("X6:X361")
If c.Value = "IP/OP Obs" Then
c.Offset(, 39).Value = "No IP acuity documented; should have been OP
Observation"
End If
Next
End Sub


Mike


"akemeny" wrote:

Hi,

I browsed through all the other posts before posting this. I was hoping it
would be a easy macro, but it doesn't appear to be so I thank anyone that
helps in advance.

What I need is a Macro that will do the following:

1. Look at the data in each cell of Range X6:x361
2. Find "IP/OP Obs"
3. Enter "No IP acuity documented; should have been OP Observation" into the
corresponding cell for that row in column BK

And I need it to loop continuously. In addition I need to prevent the macro
from giving me an error when it comes to a blank cell.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to add text to cell


I haven't had time to test this but this should do the trick:

Sub find_n_replace()
Dim Rng As Range, MyCell As Range
Set Rng = ActiveSheet.Range("X6:X361")
For Each MyCell In Rng
If MyCell.Value = "IP/OP Obs" Then
ActiveSheet.Range("BK" & MyCell.Row).Value = _
"No IP acuity documented; should have been OP Observation"
End If
activesheets.Columns("BK").AutoFit
End Sub


--
The Code Cage Team

Regards,
The Code Cage Team
www.thecodecage.com
------------------------------------------------------------------------
The Code Cage Team's Profile: http://www.thecodecage.com/forumz/member.php?userid=2
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=7656

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to add text to cell


Sorry i forgot the "Next" off the code!

Sub find_n_replace()
Dim Rng As Range, MyCell As Range
Set Rng = ActiveSheet.Range("X6:X361")
For Each MyCell In Rng
If MyCell.Value = "IP/OP Obs" Then
ActiveSheet.Range("BK" & MyCell.Row).Value = _
"No IP acuity documented; should have been OP Observation"
End If
Next MyCell
activesheet.Columns("BK").AutoFit
End Sub


--
The Code Cage Team

Regards,
The Code Cage Team
www.thecodecage.com
------------------------------------------------------------------------
The Code Cage Team's Profile: http://www.thecodecage.com/forumz/member.php?userid=2
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=7656

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
Can I record a macro on a cell that has text but not a text box Bryan De-Lara[_2_] Excel Worksheet Functions 2 November 2nd 08 05:45 PM
Macro - Inserting text to a cell already containg text Dileep Chandran Excel Worksheet Functions 5 December 7th 06 03:42 PM
Macro - Inserting text to a cell already containg text Dileep Chandran Excel Discussion (Misc queries) 6 December 7th 06 03:42 PM
Need a macro to insert text in a cell that already has text.Excel go1angel Excel Discussion (Misc queries) 2 October 5th 05 10:32 PM
Need a macro to insert text in a cell that already has text.Excel go1angel Excel Programming 1 October 4th 05 06:54 PM


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