S
salanssr
I have a problem and I am a rookie when it comes to excel macros.
We create parts catalogs and have to run a supersession for parts in
our files. This is very redundant and I would like to create a macro
to automatically search for "old part" and replace with "new part".
I am trying to take a string from a given cell in worksheet-1 (range
B1) , search for the same string in worksheet-2, replace string 1 in
worksheet 2 with another part from worksheet 1 (range G1). Then
delete the entire row and go to the next row and repeat the same
operation. I attached the macro I am trying to use with little
success. It only changes 1 cell in file 2 instead of searching for a
new number and the program keeps running until I can break. Hope this
makes sense.
Sub supersessions()
'
' supersessions Macro
' Macro recorded 9/10/2003 by stu
'
'
Dim strOld As String
Dim strNew As String
Do Until strOld = Null
strOld = Range("B1").Value
strNew = Range("G1").Value
Windows("651724M9.xls").Activate
Cells.Find strOld
Selection.Value = strNew
Windows("SSRPT.xls").Activate
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Loop
End Sub
Hope someone can help, for I am lost.
Stu
We create parts catalogs and have to run a supersession for parts in
our files. This is very redundant and I would like to create a macro
to automatically search for "old part" and replace with "new part".
I am trying to take a string from a given cell in worksheet-1 (range
B1) , search for the same string in worksheet-2, replace string 1 in
worksheet 2 with another part from worksheet 1 (range G1). Then
delete the entire row and go to the next row and repeat the same
operation. I attached the macro I am trying to use with little
success. It only changes 1 cell in file 2 instead of searching for a
new number and the program keeps running until I can break. Hope this
makes sense.
Sub supersessions()
'
' supersessions Macro
' Macro recorded 9/10/2003 by stu
'
'
Dim strOld As String
Dim strNew As String
Do Until strOld = Null
strOld = Range("B1").Value
strNew = Range("G1").Value
Windows("651724M9.xls").Activate
Cells.Find strOld
Selection.Value = strNew
Windows("SSRPT.xls").Activate
Rows("1:1").Select
Selection.Delete Shift:=xlUp
Loop
End Sub
Hope someone can help, for I am lost.
Stu