excel vba macro delete column based on cell content -


i'm trying write macro delete columns spreadsheet if have content. data in first row, of variable length. think problem may have range selection. keep getting subscript out of range when try search. advice appreciated. :)

sub disk_firmware()    dim c range    dim srchrng range    dim srchstr string    set srchrng = activesheet.range("a1").entirerow    srchstr = inputbox("please enter search string")          set c = srchrng.find(srchstr, lookin:=xlvalues)       if not c nothing c.entirecolumn.delete    loop while not c nothing end sub 

your code works absolutely fine in vbe. added following:

srchstr = trim(srchstr) 

for error, msdn website suggests use next instead of while, not specify index elements.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -