Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Macro - update the cell to the left after a find

Hello,
I have a macro that I need to find a certain cell and update the cell to the
right of that one with a certain value. My Macro is below; it currently finds
the record for Gregory T Pattens. I then want it to update the cell directly
to the right of this one with the value "n/a". Gregory T Pattens will not
consistently be in the same location, so I can't have it locked down to
always update a specific cell. I had thought that the RC[1] would move to the
right but instead it's overwriting Gregory T Patten's name with
"RC[1]=""n/a"""

Thank you!!!


Sub Macro4()

' Macro4 Macro
' Macro recorded 4/12/2007 by Jen Frost
'
Columns("B:B").Select
Selection.Find(What:="Pattins,Gregory T", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.FormulaR1C1 = "RC[1]=""n/a"""
End Sub

--
Thank you! - Jennifer
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Macro - update the cell to the left after a find

Use this instead:
ActiveCell.Offset(0,1) = "n/a"

Merjet


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Macro - update the cell to the left after a find

Hi Jennfier,

Try it this way:

ActiveCell.Offset(0, 1).Value = "n/a"


--
Hope that helps.

Vergel Adriano


"Jennifer Cali" wrote:

Hello,
I have a macro that I need to find a certain cell and update the cell to the
right of that one with a certain value. My Macro is below; it currently finds
the record for Gregory T Pattens. I then want it to update the cell directly
to the right of this one with the value "n/a". Gregory T Pattens will not
consistently be in the same location, so I can't have it locked down to
always update a specific cell. I had thought that the RC[1] would move to the
right but instead it's overwriting Gregory T Patten's name with
"RC[1]=""n/a"""

Thank you!!!


Sub Macro4()

' Macro4 Macro
' Macro recorded 4/12/2007 by Jen Frost
'
Columns("B:B").Select
Selection.Find(What:="Pattins,Gregory T", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.FormulaR1C1 = "RC[1]=""n/a"""
End Sub

--
Thank you! - Jennifer

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Macro - update the cell to the left after a find

Give this a whirl. Your existing code will bomb if Greg is not found. This
code will be just fine...

Sub Macro4()
' Macro4 Macro
' Macro recorded 4/12/2007 by Jen Frost
Dim rngFound As Range
Set rngFound = Columns("B:B").Find(What:="Pattins,Gregory T", _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
MatchCase:=False)
If Not rngFound Is Nothing Then rngFound.Offset(0, 1).Value = "n/a"
End Sub
--
HTH...

Jim Thomlinson


"Jennifer Cali" wrote:

Hello,
I have a macro that I need to find a certain cell and update the cell to the
right of that one with a certain value. My Macro is below; it currently finds
the record for Gregory T Pattens. I then want it to update the cell directly
to the right of this one with the value "n/a". Gregory T Pattens will not
consistently be in the same location, so I can't have it locked down to
always update a specific cell. I had thought that the RC[1] would move to the
right but instead it's overwriting Gregory T Patten's name with
"RC[1]=""n/a"""

Thank you!!!


Sub Macro4()

' Macro4 Macro
' Macro recorded 4/12/2007 by Jen Frost
'
Columns("B:B").Select
Selection.Find(What:="Pattins,Gregory T", After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
ActiveCell.FormulaR1C1 = "RC[1]=""n/a"""
End Sub

--
Thank you! - Jennifer

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
TO FIND VALUE TO THE LEFT THE CELL USING VLOOKUP OR ANY OTHER CAPTGNVR Excel Discussion (Misc queries) 10 February 14th 07 11:16 PM
Excel 2K3 Macro - Find and Update kdub-u Excel Worksheet Functions 2 August 30th 06 07:14 PM
Find LARGE, and th cell 3 cells to the left? Intotao Excel Worksheet Functions 1 January 9th 06 09:33 PM
Find and Update Macro hnyb1 Excel Discussion (Misc queries) 2 October 11th 05 03:30 PM
Timestamp cell to left after update Tahlmorrah Excel Discussion (Misc queries) 3 December 3rd 04 12:35 AM


All times are GMT +1. The time now is 11:41 AM.

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"