Code assistance

Silo

Active Member
Joined
Mar 8, 2004
Messages
447
Hello Everyone

I have a sheet that I need some assistance with some code, here’s the scenario…
I need a code that will look at all cells in column “N” looking specifically for “999999” and or “?”.

Then for those cells with the “999999” and or “?”, bring the values in the corresponding row in column “K” into the cell with the “999999” and or “?” in column “N” and change the cell shading for quick identification, yellow will work.

Any help would be great appriciated

Thanks Everyone :)
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Give this a try:
Code:
Sub Replace()
Dim R As Range
For Each R In Range("N:N")
    If R.Value = 999999 Or R.Value = "?" Then
        Range("N" & R.Row) = Range("K" & R.Row)
        Range("N" & R.Row).Interior.ColorIndex = 36
    End If
Next R
End Sub
 
Upvote 0
try this:

Code:
Sub test()
Dim myRange As Range, c As Range

Set myRange = Sheet1.Range("N1:N" & Sheet1.Range("N65000").End(xlUp).Row)

With Sheet1
    For Each c In myRange
        If c.Value = 999999 Or c.Value = "?" Then
            c.Value = .Range("K" & c.Row).Value
            c.Interior.ColorIndex = 6
        End If
    Next c
End With

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,833
Members
452,947
Latest member
Gerry_F

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