![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Location: Chile
Posts: 3
|
I have a process that I am having repeat numerous times. it is in a search of a range I specify (a2:a10) and that it looks (search) for the content of a cell specifies (b2) and it replaces by the content of a cell specifies (c2).
¿How I make to change the values of the cells (b2, c2) to (b3, c3) to (b4,c4)etc ? please help. i try this Dim celdaA As Range Dim celdaD As Range Dim celdaB As Range Set celdaA = Worksheets("Datos DWG").Range("a2:a100") Set celdaD = Worksheets("Datos DWG").Range("d2") Set celdaB = Worksheets("Datos DWG").Range("b2") With celdaA Set c = .Find(celdaB, LookIn:=xlValues) If Not c Is Nothing Then firstAddress = c.Address c.Value = celdaD Set c = .FindNext(c) End If End With End Sub thanks , thank you very much by any aid or suggestion Pedro |
|
|
|
|
|
#2 | |
|
Board Regular
Join Date: Feb 2002
Posts: 74
|
Quote:
I assumed that you wanted to replace the values located in B2:B10 with the corresponding values in D2:D10. Dim celdaA As Range Dim celdaD As Range Dim celdaB As Range For i = 2 to 10 ' or whatever you need Set celdaA = Worksheets("Datos DWG").Range("a2:a100") Set celdaD = Worksheets("Datos DWG").Cells(i,4) ' From D2 to D10 Set celdaB = Worksheets("Datos DWG").Cells(i,2) ' From B2 to B10 With celdaA Set c = .Find(celdaB, LookIn:=xlValues) If Not c Is Nothing Then firstAddress = c.Address c.Value = celdaD Set c = .FindNext(c) End If End With Next i End Sub
__________________
"Interfere? Of course we should interfere! Always do what you're best at, that's what I say!" -- The Doctor, Nightmare of Eden |
|
|
|
|
|
|
#3 |
|
New Member
Join Date: Apr 2002
Location: Chile
Posts: 3
|
Yesss
Thanks, thanks, thanks Thanks for your help Tim!!! gracias amigo un abrazo de Chile |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|