Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm not to good a complex macros so If someone could help I'd much
appreciate it.I like to create a macro to change to value of a cell 2 cols left of a search string,same row.I have a sheet with 25 cols and 7500 rows,at various places the string oz is in a cell,I need to change the value in the cell 2 cols left,how could I do this with a macro ?.The search string is usually but not always the same col,the value to be changed is always second col left. Thanks SteveC |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way:
Public Sub ReplaceLeftOfOz() Const sFIND As String = "oz" Const vREPLACE As Variant = "<Your Value Here" Dim rFound As Range Dim sFoundAddr As String With ActiveSheet Set rFound = .Cells.Find( _ What:=sFIND, _ LookIn:=xlValues, _ LookAt:=xlWhole, _ MatchCase:=False) If Not rFound Is Nothing Then sFoundAddr = rFound.Address Do rFound.Offset(0, -2).Value = vREPLACE Set rFound = .Cells.FindNext(rFound) Loop Until rFound.Address = sFoundAddr End If End With End Sub In article .com, wrote: I'm not to good a complex macros so If someone could help I'd much appreciate it.I like to create a macro to change to value of a cell 2 cols left of a search string,same row.I have a sheet with 25 cols and 7500 rows,at various places the string oz is in a cell,I need to change the value in the cell 2 cols left,how could I do this with a macro ?.The search string is usually but not always the same col,the value to be changed is always second col left. Thanks SteveC |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thanks
|
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Look at the sample code for the FindNext method. this should get you
started. If you need further help, post back. -- Regards, Tom Ogilvy wrote in message oups.com... I'm not to good a complex macros so If someone could help I'd much appreciate it.I like to create a macro to change to value of a cell 2 cols left of a search string,same row.I have a sheet with 25 cols and 7500 rows,at various places the string oz is in a cell,I need to change the value in the cell 2 cols left,how could I do this with a macro ?.The search string is usually but not always the same col,the value to be changed is always second col left. Thanks SteveC |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
" wrote:
I'm not to good a complex macros so If someone could help I'd much appreciate it.I like to create a macro to change to value of a cell 2 cols left of a search string,same row.I have a sheet with 25 cols and 7500 rows,at various places the string oz is in a cell,I need to change the value in the cell 2 cols left,how could I do this with a macro ?.The search string is usually but not always the same col,the value to be changed is always second col left. Thanks SteveC Assuming you've search with a macro, your next line could be:- ActiveCell.Offset(0, -2).Value = whatever |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
2 Cols To 2 Cols VLookup Comparison | Excel Discussion (Misc queries) | |||
Macro for single to multiple cols. Help! | New Users to Excel | |||
Cond Format:re color 2 cols, skip 2 cols | Excel Worksheet Functions | |||
Excel XP VBA code to search all macro code in Excel module for specific search string criteria | Excel Programming | |||
Excel XP VBA code to search all macro code in Excel module for specific search string criteria | Excel Programming |