Rafael NAVARRO
New Member
- Joined
- Dec 14, 2020
- Messages
- 3
- Office Version
- 2016
- Platform
- Windows
Hello All:
I'm trying to copy and paste several hundreds of lines and then change a value by a variable.
the text to change is ,2, and I want to replace it by a variable (Count) that will be in a loop, nevertheless when trying the code below I just get the Count as text but not the variable number.
could you please help me?
---------------------------------------------------------------------------------------------------------------------
Range(Cells(ren1, col1), Cells(ren1, col2)).Select
Selection.Copy
Count = Count + 1
ren1 = ren1 + 1
Range(Cells(ren1, col1), Cells(ren1, col2)).Select
ActiveSheet.Paste
Selection.Replace What:=",2,", Replacement:=",""Count"",", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
I'm trying to copy and paste several hundreds of lines and then change a value by a variable.
the text to change is ,2, and I want to replace it by a variable (Count) that will be in a loop, nevertheless when trying the code below I just get the Count as text but not the variable number.
could you please help me?
---------------------------------------------------------------------------------------------------------------------
Range(Cells(ren1, col1), Cells(ren1, col2)).Select
Selection.Copy
Count = Count + 1
ren1 = ren1 + 1
Range(Cells(ren1, col1), Cells(ren1, col2)).Select
ActiveSheet.Paste
Selection.Replace What:=",2,", Replacement:=",""Count"",", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False