» Search, enter, and delete values using VBA in Microsoft Excel
CATEGORY - General Topics in VBA
VERSION - All Microsoft Excel Versions
The value in the active cell in column A is to be searched in the other cells of the column. If found, the value from column C of the found place is to be
Answer:
Place the code below into the standard module.
Sub Tryclear()
Dim rng As Range
Dim lngRow As Long, lngLastRow As Long
Application.ScreenUpdating = False
Set rng = ActiveCell
lngLastRow = Cells(Rows.Count, 1).End(xlUp).Row
For lngRow = lngLastRow To rng.Row + 1 Step -1
If Cells(lngRow, 1).Value = rng.Value Then
rng.Offset(0, 2).Value = rng.Offset(0, 2).Value + Cells(lngRow, 3).Value
Rows(lngRow).Delete
End If
Next lngRow
Application.ScreenUpdating = True
End Sub
Book Store:
Recommended Books:
- PowerPoint® 2002 For Dummies®
- Microsoft Access Version 2002 Step by Step
- Real Estate Finance and Investments (Real Estate Finance and Investments, 11th Ed)
- Dictionary of Finance and Investment Terms
- Microsoft Office XP Introductory Concepts and Techniques
- Who Moved My Cheese? An Amazing Way to Deal with Change in Your Work and in Your Life
No comments have been submitted.

