help #14

I have the following macro running in a workbook.
the problem i have with this is that when it creates the 
new workbook with certain sheets missing, it changes the 
orignal to the new workbook 
can anyone help 

Private Sub CommandButton1_Click()
Dim wb As Workbook
'copy all sheets
Worksheets.Copy
Set wb = ActiveWorkbook
Application.DisplayAlerts = False
'delete the sheets you want
wb.Sheets(Array("Suspense", "RCA exc RIM", "Operations 
summary", "RCA incl RIM", "First Qtr", "Second 
Qtr", "Third Qtr", "Fourth Qtr")).Delete
Application.DisplayAlerts = True

For Each Sh In wb.Worksheets
        Sh.Columns("A:B").EntireColumn.Delete
    Next
End Sub
0
anonymous (74722)
4/29/2005 1:59:42 PM
excel 39879 articles. 2 followers. Follow

3 Replies
518 Views

Similar Articles

[PageSpeed] 30

Mark

No quite sure I understand the problem, are you trying to change a workbook 
that is open from another workbook with the cosde in.

If you are then a better way thamn using ActiveWorkbook is to create a 
workbook object variable
e.g.

dim wbNew as workbook.

set wbNew = workbooks.add

That way the variable is always assigned to the new workbook and not the 
activeworkbook which if you are clicking a button must be the one containing 
the code and not the one you want to work on.
Hope this helps.
Nick


"mark" <anonymous@discussions.microsoft.com> wrote in message 
news:0ea701c54cc3$b111e1c0$a601280a@phx.gbl...
>I have the following macro running in a workbook.
> the problem i have with this is that when it creates the
> new workbook with certain sheets missing, it changes the
> orignal to the new workbook
> can anyone help
>
> Private Sub CommandButton1_Click()
> Dim wb As Workbook
> 'copy all sheets
> Worksheets.Copy
> Set wb = ActiveWorkbook
> Application.DisplayAlerts = False
> 'delete the sheets you want
> wb.Sheets(Array("Suspense", "RCA exc RIM", "Operations
> summary", "RCA incl RIM", "First Qtr", "Second
> Qtr", "Third Qtr", "Fourth Qtr")).Delete
> Application.DisplayAlerts = True
>
> For Each Sh In wb.Worksheets
>        Sh.Columns("A:B").EntireColumn.Delete
>    Next
> End Sub 


0
nick2029 (26)
4/29/2005 2:16:47 PM
What I have is budget workbook, called Master Budget 05-
06 which I work on everyday. At the end of the month I 
have to create a workbook minus certain sheets and 
columns to send out to budget holder in order for them to 
keep up to date on what they spend this is called Book 1. 
This workbook is only for ref for that month and it can 
be deleted. So when I run this macro it changes the 
original (which is held in a database) to the book 1 and 
the master then becomes the scrap one if you get my 
drift. 

thanks

Mark
>-----Original Message-----
>Mark
>
>No quite sure I understand the problem, are you trying 
to change a workbook 
>that is open from another workbook with the cosde in.
>
>If you are then a better way thamn using ActiveWorkbook 
is to create a 
>workbook object variable
>e.g.
>
>dim wbNew as workbook.
>
>set wbNew = workbooks.add
>
>That way the variable is always assigned to the new 
workbook and not the 
>activeworkbook which if you are clicking a button must 
be the one containing 
>the code and not the one you want to work on.
>Hope this helps.
>Nick
>
>
>"mark" <anonymous@discussions.microsoft.com> wrote in 
message 
>news:0ea701c54cc3$b111e1c0$a601280a@phx.gbl...
>>I have the following macro running in a workbook.
>> the problem i have with this is that when it creates 
the
>> new workbook with certain sheets missing, it changes 
the
>> orignal to the new workbook
>> can anyone help
>>
>> Private Sub CommandButton1_Click()
>> Dim wb As Workbook
>> 'copy all sheets
>> Worksheets.Copy
>> Set wb = ActiveWorkbook
>> Application.DisplayAlerts = False
>> 'delete the sheets you want
>> wb.Sheets(Array("Suspense", "RCA exc RIM", "Operations
>> summary", "RCA incl RIM", "First Qtr", "Second
>> Qtr", "Third Qtr", "Fourth Qtr")).Delete
>> Application.DisplayAlerts = True
>>
>> For Each Sh In wb.Worksheets
>>        Sh.Columns("A:B").EntireColumn.Delete
>>    Next
>> End Sub 
>
>
>.
>
0
anonymous (74722)
4/29/2005 2:36:50 PM
I think I get you now.

Maybe a way to achieve this would be to use Thisworkbook.SaveAs and save the 
master as a new book. Then the macro will run in the copied workbook.

Nick



"mark" <anonymous@discussions.microsoft.com> wrote in message 
news:0e0f01c54cc8$e1582e70$a401280a@phx.gbl...
> What I have is budget workbook, called Master Budget 05-
> 06 which I work on everyday. At the end of the month I
> have to create a workbook minus certain sheets and
> columns to send out to budget holder in order for them to
> keep up to date on what they spend this is called Book 1.
> This workbook is only for ref for that month and it can
> be deleted. So when I run this macro it changes the
> original (which is held in a database) to the book 1 and
> the master then becomes the scrap one if you get my
> drift.
>
> thanks
>
> Mark
>>-----Original Message-----
>>Mark
>>
>>No quite sure I understand the problem, are you trying
> to change a workbook
>>that is open from another workbook with the cosde in.
>>
>>If you are then a better way thamn using ActiveWorkbook
> is to create a
>>workbook object variable
>>e.g.
>>
>>dim wbNew as workbook.
>>
>>set wbNew = workbooks.add
>>
>>That way the variable is always assigned to the new
> workbook and not the
>>activeworkbook which if you are clicking a button must
> be the one containing
>>the code and not the one you want to work on.
>>Hope this helps.
>>Nick
>>
>>
>>"mark" <anonymous@discussions.microsoft.com> wrote in
> message
>>news:0ea701c54cc3$b111e1c0$a601280a@phx.gbl...
>>>I have the following macro running in a workbook.
>>> the problem i have with this is that when it creates
> the
>>> new workbook with certain sheets missing, it changes
> the
>>> orignal to the new workbook
>>> can anyone help
>>>
>>> Private Sub CommandButton1_Click()
>>> Dim wb As Workbook
>>> 'copy all sheets
>>> Worksheets.Copy
>>> Set wb = ActiveWorkbook
>>> Application.DisplayAlerts = False
>>> 'delete the sheets you want
>>> wb.Sheets(Array("Suspense", "RCA exc RIM", "Operations
>>> summary", "RCA incl RIM", "First Qtr", "Second
>>> Qtr", "Third Qtr", "Fourth Qtr")).Delete
>>> Application.DisplayAlerts = True
>>>
>>> For Each Sh In wb.Worksheets
>>>        Sh.Columns("A:B").EntireColumn.Delete
>>>    Next
>>> End Sub
>>
>>
>>.
>> 


0
nick2029 (26)
4/29/2005 2:45:35 PM
Reply:

Similar Artilces:

Help with conditional formatting with 2000
Any help would be greatly appreciated. I am trying to group data together into increments of 10% of th numbers and then chart them based on these groups. For example, I hav 300 data points that vary from 20 to 500 in value. I want them t appear in a chart based on the number of values that fall in the lowes 10% of numbers (ie. 20-40) then the next 10% (ie. 40-60) etc. up to th top 10% of numbers, but I do not want to manually determine what thes ranges are. I want to see a distribution of how many numbers fal within each 10% of values. I am not sure if this makes sense, please let me know...

Help! Setfocus problem
i ave a dropdown field on the first tab. I use setfocus so that it selects a different field to stop users scrolling down and changing the selection on the load event. Problem When a user changes tab and come back to the origional tab the setfocus doesnt run as the form is already loaded. How do you get around this? This is driving me and users mad at minute...please help before i open another bottle of dark rum! Hi Brian, Check out following URL; how to fire onclick event on tab click. It may help you. http://crmrocks.net/?p=16 -- PLEASE do click on Yes or No button if this post wa...

Please Help!!
I am having problems restoring a backup money file from my cdrw disc. I recieve the error that it can't open possibly because it is a read only file or you do not have permission to change it or your disk drive is write protected. I have never had this problem before. I have restored files from my cd backup 3 times before without a problem. Please help!!!! Restore the file to writable media - your hard drive. If you still can't open it, right-click on the file in its new location, choose Properties from the context menu, and remove the check from the 'read-only' box. -...

You wont believe this! SERVER DOWN
I was helping the operations/it director to get RPC over HTTP going on their exchange server for a company I use to be the sys admin for. The ops/it director was doing the add/remove programs portion to add rpc over http there, somehow in the process of doing this he managed to uninstall IIS -or- just NNTP and SMTP (I can't figure out which and he claims he did neither). Long story short, I've reinstalled NNTP and SMTP, reconfigured SMTP to the best recollection I have of the previous config and the server still refuses to send/receive email, even internally. All services are s...

!!HELP!!! Cannot connect to Exchange Server from a RDP, ICA session or server local machine
Please excuse the posting as I wasn't sure which group to post this in. I'm having issues using Outlook from a server desktop, an RDP or ICA connection. I have remote users who connect using Citrix. They logon to the Citrix server desktop (Windows 2003 Server) and use Outlook from there. They can also use Outlook from within Citrix as it is a Published Application. I know some of you are going to suggest why don't they use OWA but let's not get into that. I can log onto any workstation here in the office and connect to the Exchange server and open their Outlook. What I and they...

Internet connection problem
Hi. I hope someone is able to cast some light on a problem. We have a home network (all computers running XP) some wired and some wireless. For about a month now we have intermittent connection problems in that any one computer (randomly) will not connect to internet. I think all of the computers have suffered from the problem. Rebooting the affected computer makes no difference but rebooting the router can sort it until the next time. Even my mobile phone occasionally cannot connect. In Firefox the message is just "server not found". Pinging an IP address results in a time...

I need help restoring Public Folders
Hi I've been having issues getting Public Folder replication going between 2 Exchange 2003 servers. Prior to doing any work I performed a Backup using Veritas Backup Exec and this completed and verified correctly. I screwed things up and managed to delete some of the public folders on my original server. I'm not 100% sure what I did but it is a mess and the only backup I have is the Exchange backup I created before doing any work. The public folders contain a number of Contact Lists and a very important Event Calendar. I have restored the public folders but when the restore c...

Help with Synchronizing a user folder with a Public Folder
Hi: Hoping that someone can offer a suggestion on this one. I'd like to be able to synchronize an email folder in a particular users' Outlook account with a public folder. The idea is to have email conversation threads in a particular folder (just one folder) visible to others in the group via the public folders. Ideally, it would be great if changes to the public folder are instantly mirrored in the users folder - but that requirement is not critical, the core requirement is to have the public folder mirror the user's folder (in real time). I know that I could accomplis...

Need help on a formula 05-20-10
I need a formula to calculate the following information please: I will have someone enter a time (ex 6:31) in cell C3. If the time matches one of the times in cells B17-B22 I need it to display 4.6, if it matched one of the times in cells B23-28 I need it to display 4.7, if it matches one of the times in cells B29-34 I need it to display 4.8 and so on. Does anyone have a simple formula I can do for this please? =IF(COUNTIF(B17:B22,C3)>0,4.6,IF(COUNTIF(B23:B28,C3)>0,4.7,IF(COUNTIF(B29:B34,C3)>0,4.8,"no match"))) Can't do the "and so on" part, bu...

Terminal Servers in Cluster - Login/Profile Issues
Hello Gurus, Currently I am having an issue with logins and profiles as per details below. Server/Network Configuration Details: 1 X Windows Server 2008 Std FE 64bit (DC) 2 X Windows Server 2008 Ent 32bit Terminal Servers User Profiles are Roaming and exist in: \\SBSERVER\Profiles on the Domain Controller and C:\Users\ on the Terminal Servers. Approx 50 users. Problem Description Error messages when logging in the terminal servers: Your roaming profile is not synchronized correctly with the server. Windows will load your previously-saved local profile instead. See the pre...

RMS 2.0 matrix dimensions are annoying, but help is available
For reasons I don't understand, MS saw fit in RMS 2.0 to use dimensions data for matrix components that is far less accessible to users than Sub Descriptions are. For instance, I can't edit assign a dimension value to an existing item I have added to a matrix. I can't see a reason for using Dimensions with limitations like this as using Sub Descs. to describe matrix "dimensions" worked fine previously. Does anyone know why MS did this? It's annoying! Digital Retail Solutions (DRS) has a product called Power Ops (Build 2.2.0003). It's help file mentions (se...

can I use 11 x 14 paper in office documents?
Is it possible to use a larger sheet of paper when using publisher? Yes. First select the paper size in the Printer Setup. -- Don Vancouver, USA "Prairie Inn" <Prairie Inn@discussions.microsoft.com> wrote in message news:FC032907-D965-4DE9-891D-40DF9C6E9C8C@microsoft.com... > Is it possible to use a larger sheet of paper when using publisher? If your printer can handle it, yes. -- JoAnn Paules MVP Microsoft [Publisher] ~~~~~ How to ask a question http://support.microsoft.com/KB/555375 "Prairie Inn" <Prairie Inn@discussions.microsoft.com> w...

Excel Formula Help
I am setting up a basic excel spreadsheet and really have got no experience with excel. I want to do something real basic like if A2=laptop display $10 or if A2=desktop display $20 how do I do this? I think that if the list of options is more than a just a few, a =vlookup() function would work nicely. It may seem a little complex to start, but once you use it, you'll find tons of more reasons to use it. Debra Dalgleish has some nice instructions at: http://contextures.com/xlFunctions02.html BadSector wrote: > > I am setting up a basic excel spreadsheet and really have got no...

Help-- Having trouble opening Word & Entourage
I have to keep restarting my computer to be able to open Word or Entourage. The icons just bounce a little but won't open. I was getting a request from Entourage to rebuild the database which I did about 6 or 7 times. I got another warning which I ignored. I am on a MacBook Pro (Intel based). I am using office 2004. My Entourage database is 3.2 gb. I ran Disk Utilities a couple of times. I also had a problem a couple of times with FileMaker Pro but not sure if related. Thanks Christina On 22/8/06 20:01, in article 1156273266.788654.318170@i42g2000cwa.googlegroups.com, "...

Help with a code
I have these code and it works find: but i also want to use it for different culumn within the same sheet. how do i add Column D with different target? meaning "S" for Study and "B" for books and s on... and maybe adding a Msg box to it that will only allow the Letters specify.. thank you in advance.. Private Sub Worksheet_Change(ByVal Target As Range) If Target = "" Then Exit Sub If Target.Count > 1 Then Exit Sub If Not Intersect(Target, Range("c6:c50")) Is Nothing Then If UCase(Target) = "C" Then Target = "Contribution" El...

Need Help With GP Item Pricing
GP ITEM PRICING I need to use “Bucket Pricing” for items in GP. For example below is the pricing schedule that I need to use. First 20 …………….$ 1.75 Next 280 ……………… 1.36 Next 700 ……………… 1.23 Next 2,000 ……………… 1.09 Over 3,000 ……………… .82 So if I had a Qty. of 350 it would be as follows 20 * 1.75 = 35 280 * 1.36 = 380.80 50 * 1.23 = 61.50 Total : $477.30 In GP I can only set it up to do a “Quantity Range” in the Item Price List Maintenance window. Problem is if I set it up that way and enter a quantity of 350 it will default to the $1.23 ...

Help Please in Summing
Hello. Sorry to ask such a simple question, but I need help on how to get a total of some cells. Here's the sample. If cell A1 is 05 and is true A3 is 10 and is true A5 is 15 and is False A7 is 10 and is True A9 is 05 and is False How can I make A11 show me the result by just adding those numbers that are TRUE and give me the sum ? Would really like help, thank you. Hi Mike! I assume that you have TRUE or FALSE as boolean in an adjacent cell. If so: =SUMIF(B1:B9,"=TRUE",A1:A9) But the assumption may be wrong and you'll need to provide more information. -- Regard...

zip code help! #2
thanks for the help !!!!!!!! It worke -- cbender ----------------------------------------------------------------------- cbender3's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1556 View this thread: http://www.excelforum.com/showthread.php?threadid=27126 ...

Help! I've inherited a messed up plan :
I just came onto a project and got a 1700 line project plan from the previous 4 project managers. Q. Is it normal for tasks with unassigned ? empty resources to show that task in the Resource Usage window? And then on the Gantt View, when I add a resource under that column, it then shows up on the Task line as a Task! I've never seen this happen before. Any ideas?????? J > > Q. Is it normal for tasks with unassigned ? empty resources to show > that task in the Resource Usage window? > Sure - it shows up under the "Unassigned" label. &...

Help with my upgrade path.
We have to accomplish two things. 1. Moving the CRM server to a new machine 2. Upgrading our system to 1.2 What is the best order for this? Jake, I'm not sure it really matters which one you do first, as long as you test each step before moving on to the next. I would probably recommend installing the other server first though. That way, you will have the v1.0 server available if you run into problems with the upgrade. (Granted, it won't funciton if the DB was already upgraded, but will be there for reference). Matt "Jake Horn" <jhorn@order4chaos.com> wrote ...

Excel Help
I am an assistant accountant I would like to become an expert on excel programming. Is there anyone who can help me to achieve my dream, so that I can help others to be more efficient in excel programming and give my knowledge to others who really deserve in the performance of their duty. Thks -- Michel That's a tall order... and it depends somewhat on your existing programming experience with other programming languages. There are several books out in the marketplace covering various levels of programming from absolute beginner to outright professional, so one or more ...

plz help in to creat formula of excel
hello to all i want to discuss my problem with you related to MS excel. i want to know or find out formula of excel which can help me in such way.... i want to make grade point of my college students in such a way.. for example.... marks grade point average 50 1 53 1.3 60 2 68 2.8 70 3 76 3.6 80 4 84 4 89 4 90 4 98 4 100 4 this is example the student who get 50 marks the GPA will be 1 and who get 80 marks or above 80 the GPA should be 4 GPA should not less than 1 or grator than 4 please tell me the formula so that i can make this GPA thanks a lo -- khushe --------------------------...

Problem with Exchange HTTP virtual server..pls help
Hi, I created Exchange Virtual Server using ESM & the same is not getting reflected under IIS.. What could be the problem here? pls guide... At present, i have 2 Exchange Virtual Servers (http servers) under Protocols > HTTP section of ESM. However, when i open IIS i only see Default Website? Also, i am unable to start/stop newly created Virtual Server using ESM as these options are grayed out. Any help appreciated. I would re-write my query in more detail as follows : Hi, I have my scenario as follows : 1 Front end server 1 Back end server Front end server has 2 ip ad...

Help with Highlighting all duplicates in a row
I am trying to highlight duplicates in a row and am using the explanation: Highlighting Duplicate Entries Our first task is to highlight the cells in Range1 that are duplicates. We use Excel's Conditional Formatting tool to accomplish this. First, highlight the entire Range1. Then, select the Conditional Formatting tool from the Format menu: Format->Conditional Formatting. Change the "Cell Value Is" option to "Formula Is" and enter the following formula in the formula text box: =IF(COUNTIF(Range1, A5)>1,TRUE,FALSE) Where A5 is the first cell in Range1....

Converting Access 97 to Access 2003 10-14-05
This is my first conversion. Can anyone offer tips on the easiest and safest way to convert a multi user database which was developed in Access 97 to Access 2003? You can try opening A2003, and before opening any database, choose: Tools | Database Utilities | Convert Database. If you run into problems, see: Converting from Access 97 to 2000, 2002 or 2003 at: http://allenbrowne.com/ser-48.html -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Jane...