Sunday, 15 June 2014

deleting rows containing excel vba -



deleting rows containing excel vba -

new vba , first time posting question. have workbook contains 50k records. info comprised of approx. 2700 stocks with bi-weekly info updates @ price, volume traded, etc. updating info bi-weekly, , when going eliminate securities don't meet criteria. @ each update, there may 30 - 50 securities need removed, time consuming filter each 1 , delete rows security.

my hope able maintain table on sheet called "filters" can manually populate "deletes" each time need remove securities, run macro filters downwards securities , deletes rows.

here i've tried far filter info downwards required rows. can't seem work. error in bold line below.

i have table called "filtering" named in sheet "filters" (fifth sheet) , raw info in sheet called "data" (first sheet). help appreciated.

sub deleterows() dim filtering variant dim ws1 worksheet, ws2 worksheet dim sedol range, rngdata range set ws1 = worksheets("data") set ws2 = worksheets("filters") set rngdata = ws1.range("$d$1").currentregion **set sedol = ws2.range("filtering")** filtering = sedol.value rngdata.autofilter field:=1, _ criteria1:=application.transpose(filtering), _ operator:=xlfiltervalues

i set quick test workbook , got working changing 1 line to:

set sedol = ws2.range("filtering[stock]")

the table created (insert, table table tools, table name filtering) on filters worksheet had header row column label beingness stock. i'm unclear on exact nature of table created worked me. believe have alter way referencing column of info within table. if cannot working quickly, generate macro records going column of stocks , tapping ctrl+<spacebar> select column of stock names within table. might clear syntax issues on selecting column of info table.

excel vba excel-vba rowdeleting

No comments:

Post a Comment