chuckdanger
New Member
- Joined
- Apr 27, 2015
- Messages
- 7
Hello, I would like to create a macro to find and replace parts of my model with data that the user chooses with input boxes. i have used this method before and it works well, there is just a missing link between the Input Box and Replace function
Sorry if my formatting is not perfected this is my first post on this forum, please let me know what I can do better.
This is part of what I have so far . . .
The macro will run smoothly but the values are not found and replaced so I am thinking its is how the variables are set up, all input welcome
Sorry if my formatting is not perfected this is my first post on this forum, please let me know what I can do better.
This is part of what I have so far . . .
Code:
Dim rff As Variant
Dim rfr As Variant
Dim pyf As Variant
Dim pyr As Variant
budprod.Activate
Sheets("US.TOTL").Activate
Range("BO3").Activate
''Set Current Year RF and Budget Variables
Set x1 = Application.InputBox("In Row 5 Select Month That Just Ended", "Select RF & BUD 'Find' Column", Type:=8)
'///////// RF & BUD FIND VARIABLE \\\\\\\\\\\
rff = x1.Column
Set x2 = Application.InputBox("In Row 5 Select Month That Has Just Started", "Select RF & BUD 'Replace' Column", Type:=8)
'///////// RF & BUD REPLACE VARIABLE \\\\\\\\\\\
rfr = x2.Column
model.Activate
Sheets("Data Summary").Activate
Range("RFData").Select
Selection.Replace What:=rff, Replacement:=rfr, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
The macro will run smoothly but the values are not found and replaced so I am thinking its is how the variables are set up, all input welcome