excel vba - RUN time error 1004 , no data was selected to parse -


i have svg files in folder , have written vba code xml data svg files here code

sub macro4()  dim lines long dim letter string dim no string dim count integer dim integer dim xrow long dim xdirect$, xfname$, initialfoldr$      count = sheets.count     if count > 1     = 1 sheets.count         sheets(i).select         on error goto loopexit         if activesheet.name = "execute"         elseif activesheet.name = "sheet1"         else             application.displayalerts = false             activesheet.delete             application.displayalerts = false             = - 1         end if     next     end if loopexit:     initialfoldr$ = "c:\"     application.filedialog(msofiledialogfolderpicker)         .initialfilename = application.defaultfilepath & "\"         .title = "please select folder list files from"         .initialfilename = initialfoldr$         .show             if .selecteditems.count <> 0                 xdirect$ = .selecteditems(1) & "\"                 xfname$ = dir(xdirect$, 7)                 cells(1, 1).select                     while xfname$ <> ""                        application.displayalerts = false                        activesheet.querytables.add(connection:= _                             "text;" & xdirect$ & xfname$, destination:=range( _                             "$a$1"))                         .name = replace(xfname$, ".svg", "")                         .fieldnames = true                         .rownumbers = false                         .filladjacentformulas = false                         .preserveformatting = true                         .refreshonfileopen = false                         .refreshstyle = xlinsertdeletecells                         .savepassword = false                         .savedata = true                         .adjustcolumnwidth = true                         .refreshperiod = 0                         .textfilepromptonrefresh = false                         .textfileplatform = 932                         .textfilestartrow = 1                         .textfileparsetype = xldelimited                         .textfiletextqualifier = xltextqualifierdoublequote                         .textfileconsecutivedelimiter = false                         .textfiletabdelimiter = false                         .textfilesemicolondelimiter = false                         .textfilecommadelimiter = false                         .textfilespacedelimiter = false                         .textfilecolumndatatypes = array(1)                         .textfiletrailingminusnumbers = true                         .refresh backgroundquery:=false                         application.displayalerts = false                     end                     rows("1:1").select                     selection.insert shift:=xldown                     lines = activesheet.range("a65536").end(xlup).row                     rows("1:1").select                     selection.autofilter                     range("a1").select                     activesheet.usedrange.autofilter field:=1, criteria1:= _                         "<>*text transform*", operator:=xland                     activesheet.range("$a$1:$i$" & lines).offset(1, 0).specialcells _                         (xlcelltypevisible).entirerow.delete                     range("a1").select                     selection.autofilter                     range("a2").select                     range(selection, selection.end(xldown)).select                     columns("a:a").select                     selection.texttocolumns destination:=range("a1"), datatype:=xldelimited, _                         textqualifier:=xldoublequote, consecutivedelimiter:=false, tab:=false, _                         semicolon:=false, comma:=false, space:=false, other:=true, otherchar _                         :=">", fieldinfo:=array(array(1, 1), array(2, 1), array(3, 1)), _                         trailingminusnumbers:=true 

i getting run time error 1004 , decided execute line line in code applying filter filter data "text transform" , remaining data delete , in code

 rows("1:1").select                     selection.autofilter                     range("a1").select                     activesheet.usedrange.autofilter field:=1, criteria1:= _                         "<>*text transform*", operator:=xland                     activesheet.range("$a$1:$i$" & lines).offset(1, 0).specialcells _                         (xlcelltypevisible).entirerow.delete 

it delete data's except "text transform" data when execute filter deletes datas in xml file shows error on line no data selected parse

selection.texttocolumns destination:=range("a1"), datatype:=xldelimited, _                         textqualifier:=xldoublequote, consecutivedelimiter:=false, tab:=false, _                         semicolon:=false, comma:=false, space:=false, other:=true, otherchar _                         :=">", fieldinfo:=array(array(1, 1), array(2, 1), array(3, 1)), _                         trailingminusnumbers:=true 

why error happens can me rectify it?

if not range("c:c").find("*") nothing 'if it's not nothing column contains data

'run code

else

'don't run code - else eg warn user?

end if

check link : https://www.mrexcel.com/forum/excel-questions/447678-runtime-error-1004-no-data-selected-parse.html


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -