Re: Deleting lines with a variable.
- From: "Gary Keramidas" <GKeramidas@xxxxxxx>
- Date: Sat, 1 Oct 2005 22:46:32 -0400
this would delete row 10 on sheet1
Sub r()
i = 10
Worksheets("sheet1").Rows(i).EntireRow.Delete
End Sub
--
Gary
<newsuser@xxxxxxxxx> wrote in message
news:1128219501.937007.25820@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hello,
>
> In my macro I want to delete some lines depending on a test.
> I loop through some lines and do a check whether to delete the line.
> I've a linenumber stored in a variable i. The range object does not
> seem to accept my varaiable however. If I just enter the variable e.g.
>
> Worksheets(asset).Range(i).Delete
> or
> Worksheets(asset).Range(i:i).Delete
>
> Excel will not accept it. If I add quotes I get:
>
> Worksheets(asset).Range("i").Delete (which is not accepted)
> or
> Worksheets(asset).Range("i:i").Delete (which deletes a column instead
> of a row)
>
> So, how do I delete a line with a linenumber stored in a variable? If
> it's not allowed to use a variable in the rangeobject, what would be an
> efficient work around?
>
> Thanks in Advance
> Wilco
>
.
- Follow-Ups:
- Re: Deleting lines with a variable.
- From: newsuser
- Re: Deleting lines with a variable.
- References:
- Deleting lines with a variable.
- From: newsuser
- Deleting lines with a variable.
- Prev by Date: Re: email on condition from "import external data"
- Next by Date: Looping folder changing - Save Preview Picture
- Previous by thread: Deleting lines with a variable.
- Next by thread: Re: Deleting lines with a variable.
- Index(es):