[tt]Hello all, I have a 14 page workbook and would like to know if it's possible with vba to extract two specific sheets creating a separate workbook..
By "14 page workbook", do you mean a workbook containing 14 sheets (i.e., not one worksheet containing 14 pages)?
In that case, it's easy - if the worksheets you're interested in are called "dick" and "jane":
sub CopyDickandJane
dim SheetNames
SheetNames=array("dick","jane"
sheets(SheetNames).copy
end sub
Put the macro in a VBA module (either inside your 14-page workbook, or in your personal.xls). Then you can run the macro using any of the usual methods (most easily, using Alt-F8 from within Excel).
Let me challenge you a little further. I want to select all the sheets but one in a given workbook so that I can do an automatic "search and replace" using text strings that I want to keep intact in the unselected sheet. I don't want to specifically name each of the sheets in my VBA code because I will be adding other sheets in the future. I don't want to have to keep rewriting my code every time I add a new sheet. Any ideas?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.