If column B of sheet1 is same with column C of sheet3 and column J of sheet3 is BUY then add 0.05 value to column D of sheet1 and put to L column of sheet3
If column B of sheet1 is same with column C of sheet3 and column J of sheet3 is SELL then subtract 0.05 value to column D of sheet1 and put to L column of sheet3
plz see the sample file
Reg Copy and Paste
-
- Banned
- Posts: 233
- Joined: 28 Jul 2018, 17:29
Reg Copy and Paste
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78857
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Reg Copy and Paste
You could do this with a formula: in L1 of Sheet3, enter the formula
=VLOOKUP(C1,Sheet1!B:D,3,FALSE)+IF(J1="BUY",0.05,-0.05)
and fill down. If you really want to use VBA:
=VLOOKUP(C1,Sheet1!B:D,3,FALSE)+IF(J1="BUY",0.05,-0.05)
and fill down. If you really want to use VBA:
Code: Select all
Sub AddSubtract()
Dim wsh3 As Worksheet
Application.ScreenUpdating = False
Set wsh3 = Worksheets("Sheet3")
With Intersect(wsh3.Range("L:L"), wsh3.UsedRange)
.Formula = "=VLOOKUP(C1,Sheet1!B:D,3,FALSE)+IF(J1=""BUY"",0.05,-0.05)"
.Value = .Value
End With
Application.ScreenUpdating = True
End Sub
Best wishes,
Hans
Hans
-
- Banned
- Posts: 233
- Joined: 28 Jul 2018, 17:29
Re: Reg Copy and Paste
Thnx alot HansV Sir for giving ur precious time and great support to this post
Problem Solved
Have a Great Day
Problem Solved
Have a Great Day