RE: Delete Rows by urkec
urkec
Thu Jan 25 13:10:02 CST 2007
This script opens book1.xls, prompts the user to enter a value, finds that
value in column A, and deletes the row where the value was found. Is this
what you had in mind?
set XL = CreateObject ("Excel.Application")
set book = XL.Workbooks.Open ("C:\scripts\book2.xls")
set sheet = book.Worksheets ("Sheet1")
XL.Visible = true
sheet.Activate
strToFind = InputBox ("Enter a value")
set rng = sheet.Range ("A:A")
set toDel = rng.Find (strToFind)
if not toDel is nothing then
sheet.Rows (toDel.Row).Delete
else
Wscript.Echo "Not a valid selection"
end if
--
urkec
"Bernie" wrote:
> In Excel, I need a macro that will delete an entire row based on a name
> entered into an input box that would match a worksheet with that name
> in column "A".
>
>
> Thanks,
> Bernie
>
>