When you open the new workbook, it will be "active" using something like: WbName = activeworkbook.Name will store the name of the open workbook. later: Workbooks(WbName).Close SaveChanges:=False will close that workbook
Paul ----------------------------------------- “Do all the good you can, By all the means you can, In all the ways you can, In all the places you can, At all the times you can, To all the people you can, As long as ever you can.” - John Wesley ----------------------------------------- >________________________________ > From: Bud Windelborn <windel...@gmail.com> >To: excel-macros@googlegroups.com >Sent: Wednesday, November 12, 2014 2:22 PM >Subject: Re: $$Excel-Macros$$ Issue with: Open Sheet, Copy Sheet, Close Sheet, >Retain Clipboard, Paste > > > >Thanks! I'm not sure I understand yet though. > > >When I run this macro, I've already got the sheet >BusinessOrganizerMapping2013.xlsm open. I hit the button to run the macro and >another sheet opens based on the sheet name that's in cell A7 of >BusinessOrganizerMapping2013.xlsm. I can manage the copy and paste just fine, >but I'm unable to close the new sheet that the macro opened (Incidentally, the >reason I need to close the new sheet is that all the sheets I'm opening have >the same name even though they're in different locations. So when I try to >open the second one on the list I get an error that another sheet with that >name is already open). > > >The issue for me is that I don't seem to be able to re-activate the new sheet >after I've pasted to BusinessOrganizerMapping2013.xlsm. How do I re-activate, >and then close, the dynamically named sheet? > > >I tried the code you listed, but it didn't quite fit the situation I describe >above. > > > > > > > > >On Tuesday, November 11, 2014 9:45:50 PM UTC-6, Ashish Kumar wrote: >Hi Bud, >> >> >>PFA....!! >> >> >> >> >>Do changes in macro according to your requirement in Set x and Set y. >> >> >> >> >>Regards >>Ashish >-- >Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s >=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ >https://www.facebook.com/discussexcel > >FORUM RULES > >1) Use concise, accurate thread titles. Poor thread titles, like Please Help, >Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get >quick attention or may not be answered. >2) Don't post a question in the thread of another member. >3) Don't post questions regarding breaking or bypassing any security measure. >4) Acknowledge the responses you receive, good or bad. >5) Jobs posting is not allowed. >6) Sharing copyrighted material and their links is not allowed. > >NOTE : Don't ever post confidential data in a workbook. Forum owners and >members are not responsible for any loss. >--- >You received this message because you are subscribed to the Google Groups "MS >EXCEL AND VBA MACROS" group. >To unsubscribe from this group and stop receiving emails from it, send an >email to excel-macros+unsubscr...@googlegroups.com. >To post to this group, send email to excel-macros@googlegroups.com. >Visit this group at http://groups.google.com/group/excel-macros. >For more options, visit https://groups.google.com/d/optout. > > > -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout.