Quick Macro needed

pklimchuk

Board Regular
Joined
Oct 8, 2010
Messages
101
Hello Can someone help me with a Macro

I need a Macro;

If Y2 = "GGJKK", then what ever the value in W2 mulitipy by 2

but exclude the values that are ".20" ".18" ".16" ".14"
 
Still untested
Code:
Sub Test()
Dim r As Long, lr As Long
lr = Cells(Rows.Count, "W").End(xlUp).Row
    For r = lr To 2 Step -1
        If Range("W" & r) <> 0.2 And Range("W" & r) <> 0.18 And Range("W" & r) <> 0.16 And Range("W" & r) <> 0.14 And Range("Y" & r).Value = "GGJYKK" Then Range("W" & r).Value = I * 2
        Next r
End Sub
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Ok, my last throw of the dice.....still untested.
Sorry, I don't have access to Excel at the moment
Code:
Sub Test()
Dim r As Long, lr As Long
lr = Cells(Rows.Count, "W").End(xlUp).Row
    For r = lr To 2 Step -1
        If Range("W" & r).Value <> 0.2 And Range("W" & r).Value <> 0.18 And Range("W" & r).Value <> 0.16 And Range("W" & r).Value <> 0.14 And Range("Y" & r).Value = "GGJYKK" Then Range("W" & r).Value = Range("W" & r) * 2
        Next r
End Sub
 
Upvote 0
Glad you got it sorted.
Bit hard when there is no Excel around to test it......cheers !!
 
Upvote 0

Forum statistics

Threads
1,224,542
Messages
6,179,424
Members
452,914
Latest member
echoix

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