Modify VBA code

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,341
Office Version
  1. 365
Platform
  1. Windows
I want to modify this. I no longer need it to look over 7 to see if it equals "Phantom". So I need to take that part out. Just check over 2 columns and see if its a "Y" if so change G to "FLST"
but now I need it to put the "FLST" in column F not G

THANK YOU!

Code:
Sub Find_FloorStock()
'Author: G Heyman 190221
'Update "Type" Find Floor Stock and change from B to F"

'E is the Make/Buy 2 over is the FloorStock
With Range("G5", Range("E" & Rows.Count).End(xlUp))
.Value = Evaluate(Replace("if((@=""B"")*((" & .Offset(, 7).Address & "=""Phantom"")+(" & .Offset(, 2).Address & "=""Y"")),""FLST"",@)", "@", .Address))
   End With

End Sub
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
How do I get the FLST in Column G
Code:
Sub Find_FloorStock()
'Author: G Heyman 190221
'Update "Type" Find Floor Stock and change from B to F"

'E is the Make/Buy 2 over is the FloorStock
With Range("G5", Range("E" & Rows.Count).End(xlUp))
.Value = Evaluate(Replace("if((@=""B"")*((" & .Offset(, 2).Address & "=""Y"")),""FLST"",@)", "@", .Address))
   End With

End Sub
 
Upvote 0
Which columns are the "B" and "Y" in?
 
Upvote 0
The B is column E and the Y is in Column F
 
Upvote 0
In that case try
VBA Code:
Sub gheyman()
    With Range("F5", Range("E" & Rows.Count).End(xlUp).Offset(, 1))
        .Value = Evaluate(Replace("if((" & .Offset(, -1).Address & "=""B"")*(@=""Y""),""FLST"",@)", "@", .Address))
    End With
End Sub
 
Upvote 0
Unfortunately, this is not working. It doesn't error but its not putting FLST where it should (Its not putting it anywhere)
 
Upvote 0

Forum statistics

Threads
1,215,390
Messages
6,124,667
Members
449,178
Latest member
Emilou

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top