How to automatically add a worksheet using macro?

Can I add adding a worksheet in a macro? How do I do that?
Ex. I create a new macro. One of the steps in my macro is to insert a new 
worksheet.


0
Eva (12)
12/5/2007 11:12:00 AM
excel 39879 articles. 2 followers. Follow

2 Replies
304 Views

Similar Articles

[PageSpeed] 54

Dim NewWks as worksheet
set NewWks = worksheets.add
with newwks
  .name = "Your New Name Here"
  .range("A1").value = "Hi there"
End with


eva wrote:
> 
> Can I add adding a worksheet in a macro? How do I do that?
> Ex. I create a new macro. One of the steps in my macro is to insert a new
> worksheet.

-- 

Dave Peterson
0
petersod (12004)
12/5/2007 12:27:56 PM
Thank you

"Dave Peterson" wrote:

> Dim NewWks as worksheet
> set NewWks = worksheets.add
> with newwks
>   .name = "Your New Name Here"
>   .range("A1").value = "Hi there"
> End with
> 
> 
> eva wrote:
> > 
> > Can I add adding a worksheet in a macro? How do I do that?
> > Ex. I create a new macro. One of the steps in my macro is to insert a new
> > worksheet.
> 
> -- 
> 
> Dave Peterson
> 
0
Eva (12)
12/6/2007 1:49:00 AM
Reply:

Similar Artilces:

VC++ 2003 MFC used with VC 2005 Express?
I'm currently using VC++ 2003 to develop a MFC based program. At some point I may wish to move to VC++ 2005 Express edition but as I understand it this does not come supplied with MFC. Is it possible for me to install VC++ 2005 Express edition and make it use the MFC that came supplied with my VC++ 2003 ? If so, how do I configure it to do so? If this IS possible, am I likely to run into any compatability problems with other components of 2005 Express? cbdeja@my-deja.com wrote: > I'm currently using VC++ 2003 to develop a MFC based program. > > At some point I may wish ...

A program is trying to automatically send e-mail on your behalf.
I tried posting this in microsoft.public.outlook.general, but no nibbles. ------------------------------------------------------------------------------------------------------ Does anybody know how to turn the "A program is trying to automatically send e-mail on your behalf." prompte off? It pops when one of my MS Access apps is emailing one of it's reports to somebody. It happens on the Citrix server that one of my MS Apps is running on, but it does not happen when the app is running on my own PC. Consequently I'm hoping for some user-configurable setting that controls...

how to save part of an Excel worksheet as .jpg file
how to save part of an Excel worksheet as .jpg file Press CTRL+Print Screen. Open a photo editing program and paste screencap into it. Then crop down to the area you want to show as a picture. "lylegalveston" wrote: > how to save part of an Excel worksheet as .jpg file Take a screen print of the active application (alt + print screen) then edit it in a photo editor or get a program like Snagit (screen capture program), I use the latter myself and it's great Regards, Peo Sjoblom "lylegalveston" <lylegalveston@discussions.microsoft.com> wrote in messag...

Create multiple reports using macros
There is a report that I would like to run monthly for about 90 individuals and I want each individual to get their own report. Clearly, I don't want to run the report 90 times. I assume that I need a macro to do this, but have no experience writing macros. Currently, I have set up a make table query to identify the users that will need the report (since that list is subject to change) and the report is set up with the user as a parameter, now I just need to connect the two! Any assistance would be greatly appreciated. Thanks, Kevin Do you actually need 90 separate reports or can you ...

Places COM Add-in for Excel XP?
Ive installed the addin for excel 2000 on my version of excel 2002 (xp) and it doesn't work. Does anyone know if this addin is available for Excel 2002? Or of another addin which does the same thing? Thanks Adam With Excel 2002 you don't need the Places add-in. You can add folders via the Tools drop down in the Open dialog. And you can remove items by the popup menu when you right-click them. You can also change to "small icons" with the right-click menu. -- Jim Rech Excel MVP ...

Automatic CC
Hello, Is there any way to create a template where a contact is automatically CC in the email. So I dont forget to cc them every time I send an email. Thanks ...

Money 2006 constantly faults with automatic updates
Whenever I use the Internet automatic updates, money faults out and wants to send a report to Microsoft. Also my account list shows most accounts with a status of 'Update In Progress' I've done a complete reinstall after removing it and power cycling my machine. I thought it may have been something with removing 2004 and installing 2006, but got same problem Has anyone else been having this problem? I really just want to go back to Money 2004. What's the error message? -- Glyn Simpson, Microsoft MVP - Money http://money.mvps.org Check http://money.mvps.org/faq f...

Automatic axis format
Hi, I'm need to make a automatic axis format within excel. The number of rows is depending of a imported file. No problem to get the max. number of rows. But to put this number into the chart ( category axis) is more problematic. I try VB but my knowledge is at dummy level ! Waiting for your reply............. Hi, Have a look at Jon's examples of dynamic charts. http://peltiertech.com/Excel/Charts/Dynamics.html Cheers Andy jos wrote: > Hi, > I'm need to make a automatic axis format within excel. > The number of rows is depending of a imported file. > No problem to g...

How do I get an automatic equal sign to begin the formula bar?
How do I get an automatic equal sign to appear in the formula bar in Excel for Microsoft 2003? This happened for me in the 2000 version and I could just click on it with my mouse pointer, but now all that appears is the function sign with no equal sign after it. It makes my job a lot more time consuming to have to type in the equal sign while building formulas. Please help, anybody? The = icon disappeared in newer versions of excel (xl2002???). You can add an = icon Tools|customize|commands tab|Insert category (Scroll down the list until you find the = icon) And drag it to your fav...

My worksheet automatically adds a fill color when I enter text.
When I type text in a blank cell, the cell automatically is highlightes with the bright yellow fill. There is no conditional formatting on this workbook. Check your VBA editor. You might have an Event Macro which does what, usually, a CF does. Try to Increase the Macro Security to its maximum level in order to eliminate the Event Macro from running... You may, also consider to "rem" all the Macro commands by adding a Preceding apostrophe to each command. Micky > When I type text in a blank cell, the cell automatically is highlightes with > the bright yello...

autofill macro #2
I am trying to make a macro that will autofill a formula to the end of a column. However, the column is different lengths in each workbook. I autofilled to the end of the column in the first worksheet, which was 1124 cells long. Then in my next worksheet, the length was 2264 cells long, and it only autofilled to cell 1124. Is there anyway that I could autofill to the "end" of each column in each worksheet? Is there anyway that excel knows when to stop? Please help!! glee Sub Auto_Fill() Dim lrow As Long With ActiveSheet lrow = Range("C" & Rows.C...

Add Avery Label to list
Avery label 5147 is not on the Word or Publisher lists. Avery offers a download as a Word document. How can I add this template to the Word and Publisher lists for mergeing names? The same question for Avery 5390. The 5147 is the same as 5095 or 5895 in Publisher The 5390 is setup this way Width> 3.5 Height> 2.17 Change copies per sheet Side Margin> .75 Top Margin> 1.17 Gaps> Zero Print on a plain piece of paper to be sure the measurements are correct with the 5390. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com...

How to add a 2nd page to an online email newsletter in Publisher?
I have inserted a 2nd page to my online email newsletter in publisher but when I view it by either the preview or sending it to my self I cannot get to the second page!! Can someone tell me what I am doing wrong and how to fix this please. This is for my small business and I am trying to have this ready for a June 1 release. Thank you. I think the only way of getting additional story to your email is make a Publisher page twice as long (22"). Creating a multi-page PDF file may be more appreciated by your readers for it is a nicer file to save, and print out. -- Don Vancouver, ...

Automatic updates, automatically disabling itself
Automatic updates, automatically disabling itself. 2nd day now onecare popped up to tell me the updates turned themselves = off. I'm thinking what malware would want to turn the updates off ? Any idea what's going on here ? Did I AUTOMATICALLY install an update = that caused this ? <keepout@yahoo.com.invalid> wrote in message news:8l7mi5tkgp1gd15fkef71ll5mrui9ukmht@4ax.com... > Automatic updates, automatically disabling itself. > > 2nd day now onecare popped up to tell me the updates turned themselves > off. Drop OneCare and install Microsoft Sec...

using money on windows nt
I have been trying to install the trial version of money on windows nt. However, the installation is never completed. The message I get is this: money requires either windows 1998 second edition, 2000 service pack3, or xp. Can I run money on windows nt? To use Microsoft� Money Deluxe 2005 you need: a.. Windows� 98 SE or later, Windows 2000 SP3 or later, or Windows XP operating system b.. Multimedia PC with Pentium 166 or higher processor (or compatible); Pentium II 266 (or compatible) required for Windows XP; Pentium II 300 (or compatible) recommended c.. 32 M...

I open the MDB, the form runs automatically
Simple question I have an MDB file with 20 files and 7 forms in it. When I open it up, the form runs immediately an access goes into some sort of protected mode. I can't view the tables, queries etc. I can see the code by pressing Alt F11 but not the data. I created a blank db and imported the mdb so I could see the tables. But how do I open the original without it running the code? When I look at the code. I don't see anything that sets properties or invokes the code automatically. There are no macros in this, just the forms and associated code with them. Any ideas Thanks Colm ...

Having numbers automatically appear bold
Hi all, Had such great advise last time, thought I'd try again. I have a large range of cells where I will be inputing sales figures i the form of currency revenue. The range is about G-I and 1-400. Th sales data will be a comparisson of YTD 2001 - 2004 revenue results. What I hope to do is have any figure that is above $30,000 appea automatically in bold so as to stand out as a good client. I gues there is something in the IF function to do this but I'm stumped. Any ideas? Thanks again in advance. Saxte -- Message posted from http://www.ExcelForum.com select the range you wa...

How to find a record using more than one field?
I have created a table with several fields such as ID, name, date, etc. I also created a switchboard with a find command to locate a record in forms view . However the find command only searches under one field. Can I create a find command that matches 2 fields? I want my find command to find a record in form view that matches both the ID and date fields. Yes, it is possible. There are several methods that should work. Can you post what method you used to for your find command? Then if you used VBA code we can suggest a modification to the code. John Spencer Access MVP...

Add contacts to Global
I am a parent trying to get our elementary school up to date. I want to add all the students in the school's CONTACTS (address, phone, email address, etc). They do use Exchange as I saw GLOBAL as an option at one of the teacher's pc. The principal would like me to do this. They outsource their computer technical work, so I am thinking I would need administrative access to add contacts to the global contacts, correct? Since I'm not a network person, but I do know a lot about Outlook, I need to know EXACTLY how to accomplish this and what info I need to find out from the...

Is it possible to automatically move data entered in columns into rows?
Is it possible to automatically move data entered in columns into rows? It seems like a simple thing to do but I can't find a function anywhere. Cheers, Richard Thorneycroft Husky Products If you enter something in ONE cell it is automatically in a row and a column. So, perhaps a bit more explanation is in order. -- Don Guillett SalesAid Software donaldb@281.com "Richard Thorneycroft" <dancecommander81@hotmail.com> wrote in message news:9e2f3f75.0411160750.7003c6ab@posting.google.com... > Is it possible to automatically move data entered in columns into rows? >...

Report
Hi All I am writing my first report for MS CRM (version 4). I have written the report in SQL Server v5 BI Development and uploaded it into CRM. The report runs correctly for all records. The users would like to have the "Edit Filter" button. I think that pre-filtering needs to be turned on to do this but I'm not sure how to do this. I used Sales Pipeline as a model to do a similar report for a custom entity. The SQL uses FROM (' + @CRM_FilteredQ2_Job + ') as job I have tried replacing job with CRMAF_Filtered_Job but this made no difference. If anyone could provi...

Automatic Forward
How can I automatically forward messages received from a specific sender to another's e-mail person? Thanks, ...

CE6: How to Disable SIP popup automatically
Hi, I know SIP popup can be disabled by the following registry setting in CE5: [HKEY_CURRENT_USER\ControlPanel\Sip] "TurnOffAutoDeploy"=dword:1 But It doesn't work in CE6. How to disable SIP auto-Popup in CE6? Thanks. Eric The SIP Auto Deploy in CE is due to Windows Controls invoke SHSipPreference (exported by AYGSHELL.DLL). So the easiest way is to avoid including AGYSHELL (SYSGEN_AYGSHELL) But if excluding AYGSHELL is not an option, you may need to modify the SHSipPreference (PRIVATE\SHELL\SHELLPSL\HAVEAYGSHELL\shellpsl.cpp) to supress SIP s...

How do I set up a repeating meeting in Outlook but not use recurr
How do I set up a repeating meeting (or copy a meeting) in an Outlook calendar but not use the recurrence feature because the meeting are scheduled randomly. You'll need to make each one separately. Exceptions don't work well in meeting requests. -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com/ Outlook Tips by email: mailto:dailytips-subscribe-request@lists.outlooktips.net EMO - a weekly newsletter about Outlook and Exchange: mailto:EMO-NEWSLETTER-SUBSCRIBE-REQUEST@PEA...

Automatically format charts with range of dates
What I am trying to do is I have 4 charts that are linked with data from another spreadsheet. They are basically week totals for my business and make a chart compared to say last year. What I want to do though is have an option on my report that I can enter in a specific date or a range of dates and have the charts automatically filter the new data in and change. Instead of having to go into the chart data and changing what series of data I want to have a chart for I want to be able to just enter eg. "April 12-April 18" and have the charts bring up that data to reflect the ...