Jambi46n2
Active Member
- Joined
- May 24, 2016
- Messages
- 260
- Office Version
- 365
- Platform
- Windows
I am trying to conduct an automated Find and Replace with VBA Inputbox to simply replace this:
07 July 2019\SpeeDee Royalty Calculation\07.27\Sales Reports\[07.27.2019 Nexgen SpeeDee Report.xlsx]rptCustomMonthlySalesOverview'!$A$4:$I$102,5,FALSE)
To This:
08 August 2019\SpeeDee Royalty Calculation\08.03\Sales Reports\[08.03.2019 Nexgen SpeeDee Report.xlsx]rptCustomMonthlySalesOverview'!$A$4:$I$102,5,FALSE)
The text in Blue is being replaced correctly, however text in Red is not being replaced.
The code below runs without any errors.
Is there something I'm missing?
Thanks in advance.
07 July 2019\SpeeDee Royalty Calculation\07.27\Sales Reports\[07.27.2019 Nexgen SpeeDee Report.xlsx]rptCustomMonthlySalesOverview'!$A$4:$I$102,5,FALSE)
To This:
08 August 2019\SpeeDee Royalty Calculation\08.03\Sales Reports\[08.03.2019 Nexgen SpeeDee Report.xlsx]rptCustomMonthlySalesOverview'!$A$4:$I$102,5,FALSE)
The text in Blue is being replaced correctly, however text in Red is not being replaced.
The code below runs without any errors.
Is there something I'm missing?
Thanks in advance.
Code:
'Inputbox to Find and Replace
Dim x As String, y As String, m As String, nm As String
m = VBA.inputbox("Enter Month to Find. Example: 07 July 2019", "Replace What")
nm = VBA.inputbox("Enter Month to Replace. Example: 08 August 2019 ", "Replace With")
x = VBA.inputbox("Enter Date to Find. Example: 07.27", "Replace What")
y = VBA.inputbox("Enter Date to Replace. Example: 08.03 ", "Replace With")
On Error Resume Next
Selection.Replace What:=m, Replacement:=nm
Selection.Replace What:=x, Replacement:=y
On Error GoTo 0
Last edited: