Assume MyProject.xls is open
Dim v as Variant
Dim s as String
Dim s1 as String
Dim iloc as Long
s = "#RULES#CONDITIONS#ROUTING#ZONES#"
s1 = s
Redim v(0 to 0)
for each sh in Workbooks("Myproject.xls").Worksheets
iloc = instr(1,"#" & sh.Name & "#",s,vbTextCompare)
if iloc <> 0 then
v(ubound(v)) = sh.Name
s = Replace(s,sh.Name & "#","")
redim Preserve v(0 to ubound(v) + 1)
end if
Next
if len(s) < s1 then
Redim preserve v(0 to ubound(v)-1)
workbooks("Myproject.xls").Worksheets(v).copy
End if
if len(s) > 1 then
s = Right(s,len(s)-1)
s = Replace(s,"#",vbCr)
msgbox "Sheets not found: " & vbCr & s
End If
--
Regards,
Tom Ogilvy
"ilyaskazi" <ilyaskazi.1q6seb_1118030704.0853@excelforum-nospam.com> wrote
in message news:ilyaskazi.1q6seb_1118030704.0853@excelforum-nospam.com...
>
> import sheets
>
>
> i need to import sheets of following names from "MYProject.xls" in my
> new workbook.
>
> RULES, CONDITIONS, ROUTING, ZONES.
>
>
> Only check above sheet names in MyProject.xls and import in new wrkbk.
> If not found any then display its name in msgbox.
>
>
> --
> ilyaskazi
> ------------------------------------------------------------------------
> ilyaskazi's Profile:
http://www.excelforum.com/member.php...o&userid=23969
> View this thread: http://www.excelforum.com/showthread...hreadid=376676
>
Bookmarks