simple copy/paste based on criteria

snowman1976

Board Regular
Joined
Nov 4, 2008
Messages
191
hello
I tried searching the posts for this, but everything I find is more complicated than I need.

Basically, I need some code that will look in column B for the word planned. if it finds it I want it to copy range Q:W in the same row, and paste it as special values (to wipe out a formula).

Can anyone help with this?
Ultimately, if at all possible I would like the Q:W range to be easily changed by the user, either by a cell reference or some type of input at the start of the code. This is just a nice -to-have, I would be very happy with just getting the first part done

thanks in advance
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Something like this (untested)...

Code:
Sub test()
Dim Last_Row As Long
Dim r As Range

Last_Row = Range("B" & Rows.Count).End(xlUp).Row

For Each r In Range("B2:B" & Last_Row)
    If r.Value = "Planned" Then
        With Range("Q" & r.Row & ":W" & r.Row)
            .Formula = .Value
        End With
    End If
Next r


End Sub
 
Upvote 0

Forum statistics

Threads
1,224,565
Messages
6,179,549
Members
452,927
Latest member
rows and columns

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