nc_waggoner
New Member
- Joined
- Sep 2, 2016
- Messages
- 21
I am looking for a VBA code to delete the contents (not formatting) of a range of a row based on the cell value. For example, as seen below, I have number (col A), Name (col B), and Gender (col C). I would like to enter a number in Cell E2 (representing a number in column A) and have it delete the values of the Name and Gender columns. So if I type in 3 and click the button it will delete "Wayne" and "M".
[TABLE="width: 349"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Number[/TD]
[TD]Name[/TD]
[TD]Gender[/TD]
[TD][/TD]
[TD]Delete Number[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Stone[/TD]
[TD]M[/TD]
[TD][/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Jordan[/TD]
[TD]M[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Wayne[/TD]
[TD]M[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Prince[/TD]
[TD]F[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Allen[/TD]
[TD]M[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 349"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Number[/TD]
[TD]Name[/TD]
[TD]Gender[/TD]
[TD][/TD]
[TD]Delete Number[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Stone[/TD]
[TD]M[/TD]
[TD][/TD]
[TD]?[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Jordan[/TD]
[TD]M[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Wayne[/TD]
[TD]M[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Prince[/TD]
[TD]F[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Allen[/TD]
[TD]M[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]