VBA Code if cells D2 = I2 then make D2 Blank

suresh7860

New Member
Joined
Jul 18, 2015
Messages
48
Hello,

I am trying to find any way i can make it work.. lf anyone can guide me whether this can be done using vba?

I have a data sheet in that column d as data like IA12100/IA12108/A12101/P13108/H98308/615520/i752381/ii4251 and we have exceptions in column I which will be same as Column D but will be few which needs to excluded will appear here hence based on column I, if any of the data is matching with column d then for those rows column E data should be made blank.

For example if data in column i has IA12100 & p13108 in cells I10 & I28500 where as same text is in column D many cells like D2/D55/D15100/D45000 (IA12100) & D80/D822/D584/D48000 (P13108) etc which should be checked until last row and based on this it should make the E2/E55/E15100/E45000 & E80/E822/E584/E48000 etc as blank and others cells should not be changed.

excel version-2007

Thanks
Suresh7860
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Are you saying that you want column E to be blanked for rows where columns D and I contain the same value?
If so, and assuming your data starts in row 2, try this:
Code:
Sub Macro()
LastRow = ActiveSheet.Cells.SpecialCells(xlCellTypeLastCell).Row
For n = 2 to LastRow
  If Range("D" & n).Value = Range("I" & n).Value Then
    Range("E" & n).ClearContents
  End If
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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