Yet another macro question

This is what I get for trying this on my own.  I just want a macro that will 
insert 2 blank rows at the current cursor position.

Sub Insert2Rows()
'
'    qrow = ActiveCell.Row
    Rows(qrow & ":" & grow + 1).Selection.Insert Shift:=xlDown
End Sub

Any ideas?

Thanks!

Amy
0
Utf
4/27/2010 5:32:01 PM
excel.misc 78881 articles. 5 followers. Follow

3 Replies
844 Views

Similar Articles

[PageSpeed] 8

This should be close...

Sub Insert2Rows()
    ActiveCell.Resize(2, 1).EntireRow.Insert
End Sub
-- 
HTH...

Jim Thomlinson


"cvgairport" wrote:

> This is what I get for trying this on my own.  I just want a macro that will 
> insert 2 blank rows at the current cursor position.
> 
> Sub Insert2Rows()
> '
> '    qrow = ActiveCell.Row
>     Rows(qrow & ":" & grow + 1).Selection.Insert Shift:=xlDown
> End Sub
> 
> Any ideas?
> 
> Thanks!
> 
> Amy
0
Utf
4/27/2010 5:42:01 PM
As usual, you guys rock!

"Jim Thomlinson" wrote:

> This should be close...
> 
> Sub Insert2Rows()
>     ActiveCell.Resize(2, 1).EntireRow.Insert
> End Sub
> -- 
> HTH...
> 
> Jim Thomlinson
> 
> 
> "cvgairport" wrote:
> 
> > This is what I get for trying this on my own.  I just want a macro that will 
> > insert 2 blank rows at the current cursor position.
> > 
> > Sub Insert2Rows()
> > '
> > '    qrow = ActiveCell.Row
> >     Rows(qrow & ":" & grow + 1).Selection.Insert Shift:=xlDown
> > End Sub
> > 
> > Any ideas?
> > 
> > Thanks!
> > 
> > Amy
0
Utf
4/27/2010 5:47:02 PM
Hi,

Maybe this

Sub Insert2Rows()
'
qrow = ActiveCell.Row

Rows(qrow).Resize(2).Insert

End Sub
-- 
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that 
introduces the fewest assumptions while still sufficiently answering the 
question.


"cvgairport" wrote:

> This is what I get for trying this on my own.  I just want a macro that will 
> insert 2 blank rows at the current cursor position.
> 
> Sub Insert2Rows()
> '
> '    qrow = ActiveCell.Row
>     Rows(qrow & ":" & grow + 1).Selection.Insert Shift:=xlDown
> End Sub
> 
> Any ideas?
> 
> Thanks!
> 
> Amy
0
Utf
4/27/2010 5:47:02 PM
Reply:

Similar Artilces:

Autoforward Rule Question
We are a large Org, and this particular User waould like top do the following: Outlook 2003/Exchange 2000 When this User gets mail, the User would like to use a rule to Autoforward the mail item to another mailbox BUT with format change to always be HTML. Is that possible?. -- Amin M. not using rules - you'd need to write VBA to do it. -- Diane Poremsky [MVP - Outlook] Author, Teach Yourself Outlook 2003 in 24 Hours Coauthor, OneNote 2003 for Windows (Visual QuickStart Guide) Author, Google and Other Search Engines (Visual QuickStart Guide) Outlook Tips: http://www.outlook-tips.net/...

yet another sending error
Good day all I am not able to send mail but can receive them. I was using norton and uninstalled it to no avail. I tried different connections( wi fi. and 2 different dial ups) I also used the telnet tool but I get an error and i even formatted my pc... no luck. I tried 2 email addys with no success ( The connection to the server has failed. Subject '', Account: 'pop.gmail.com', Server: 'smtp.gmail.com', Protocol: SMTP, Port: 465, Secure(SSL): Yes, Socket Error: 10060, Error Number: 0x800CCC0E) Norton products when uninstalled leave a lot of proble...

Macro to show/hide detail in an outline
First post here, I hope someone can help! I have a group outline on one of my sheets that has five separate levels. I need to create buttons on the sheet to hide/show a greater or lesser level of detail (i.e. clicking an "up" button will show one additional level of detail in the outline, clicking the "down" will hide one level). I've tried using a spinner, which seemed like a suitable option. The spinner was set to minimum 1, maximum 5, linking to cell S1. I then had a simple code that ran when the spinner changed: Spincount = Range("S1") ActiveSheet.Outl...

BE question
I am constantly asked to make slight changes in forms while developing. I rolled out a new form and the users want this moved and that moved or one little slight adjustment here and there or a new field added. My problem is, I can't add a new field in a BE linked table while the users are in it. I either have to catch my BE early in the morning before users get on or late in the afternoon after they are gone. Is there any way to force a save of the BE while users are in it? Thanks so much!!!! -- Milton Purdy ACCESS State of Arkansas No, and you'd probably corrupt th...

macros #4
I want to create a macro to send a reminder mail to a mail ID on a specific date on everymonth. How to create a macro to simplify my task? See if the information on the following page helps: http://www.outlookcode.com/d/forms/skedrpt.htm -- Jocelyn Fiorello MVP - Outlook *** Messages sent to my e-mail address will NOT be answered -- please reply only to the newsgroup to preserve the message thread. *** "Maheswar" wrote: > I want to create a macro to send a reminder mail to a mail ID on a specific > date on everymonth. How to create a macro to simplify my task? &q...

Macro to update with active(live) workbooks
I am trying to record a macro that will pull from several different workbooks with active data. For Example: I want to take the data in workbook1 column "A" and copy and paste it to column "A" in workbook3, then look at workbook2 and copy and paste the data in column "A" to the first open cell in workbook3 column "A". It then needs to do the same thing for column "B" & "C". The data in workbooks 1 & 2 columns "A", "B" & "C" will be changing daily. So workbook1 column "A", &q...

Another NameTable Question
I am trying to work out the best way to use the NameTable class in my C# application. I am assuming that getting/adding a string to the nametable has the same overheads as comparing a string normally, so I have created a class which holds references to the atomized strings. Is there a better way to do this? simple example below //Class to provide "string constants" private class MyStrings { public String stringA; public String stringB; public MyStrings(NameTable nt) { stringA = nt.Add("A"); stringB = nt.Add("B"); } } //Class...

CImageList and CImage question
I want to use an image list with a list control. I am using CImage to load a bitmap file (actually several files) like: CImage image; image.Load("test.bmp"); How do I add this image to a CImageList, which can then be used by the list control? -- Regards, Frank This looks ugly but seems to be the only way. CImage image; image.Load("test.bmp"); CBitmap Bmp; Bmp.Attach(image.Detach(); m_ImageList.Add(&Bmp,RGB(0,0,0)); Bmp.DestroyObject(); image.Load("test2.bmp"); Bmp.Attach(image.Detach(); m_ImageList.Add(&Bmp,RGB(0,0,0)); Bmp.DestroyObject(); .... ...

How do I copy a formula from one worksheet to another?
I have a formula in one worksheet and want to copy that result to a cell in another worksheet. When I try to do that, I get "#REF#" in the destination cell. How can I make this work? "cahduq" <cahduq@discussions.microsoft.com> wrote in message news:B6A6EE7C-B925-4FCE-B2EE-D8F8D6B601D3@microsoft.com... >I have a formula in one worksheet and want to copy that result to a cell in > another worksheet. When I try to do that, I get "#REF#" in the > destination > cell. How can I make this work? > Copy-Paste Special-Values Hi If you on...

having one field display when another field changes
I have a field CHSTAT that updates in the original database I want a new field that will display something different as the CHSTAT updates and changes ie. CHSTAT = "10" new field = "Printed"......CHSTAT = 20 new field= "Located" Cheers!! In tables and fields you should have a table that has a field that has the CHSTAT values and a field that has the equivalent text values. Then you join that table to the current table in a query on the CHSTAT values. If you want to do this on a form, you could use a combobox to select the values. The source ...

Modify Recorded Macro
I recorded the following macro, which basically Merges 2 cells and Alignes the text to the left. However, when recording it always records the cell address(Range("D***:D***").Select. How can i adapt the cell address to something like: ActiveCell - ActiveCell.Offset(0,1).select instead of the particular cell address. I need to run this macro about 1000 times ************************* Sub MergeCells() ' ' MergeCells Macro ' ' Range("D156:E156").Select With Selection .HorizontalAlignment = xlCenter .Vertic...

SOP process question
Hi, We use SOP and have a new process that I'm not sure how to handle. We receive an order from a customer for a year's worth of product. We need to book the order to show a quantity of 12 but bill and fulfill 1 item monthly. Is there any automated way to fill the order monthly (decrement the inventory by 1 every month) and invoice without having to go in to every order? I looked at using recurring orders but that does not give us the line item with a quantity of 12 for reporting....I feel like I'm missing something very basic. Thank you! Yes and no.... ...

Curious Database Query Question
When creating a "New Database Query" from another Excel workbook, when you get to the "Select Workbook" dialog, there is a small checkbox labelled "Read Only". According to the help file, it has this to say: "To prohibit updates to this file, select the Read Only check box." I don't understand why this is an issue. In my understanding, database query is a one-way transfer of data from the external source to your excel workbook...if you edit the data in your workbook, that *doesn't* change the data back in the external source...right? Am I wr...

Moving Mailboxest another user
We use Windows 2000 Server, with Exchange 2000 using outlook. I want to be able to move the Outlook information from the mailboxes, calendars and address books from one user to another user so that I can delete the original user but not lose the information. How can I do this? Ok If the new user not have data in his mailbox the operation is very simple.. 1. Delete new user mailbox (from AD Users & Computers) 2. Delete old user mailbox (from AD Users & Computers) 3. Open Exchange System Manager navigate to server ->mailbox store -> mailboxes Right click -> run cleanu...

Excel Font question: Can you overscore a character?
I would like to overscore a character within a cell in an Excell spreadsheet. I am able to add a Equation box with an overscore (insert object, microsoft equation 3.0, overbar template), but this only seems to work in a floating text box. I would like to type in crystollography references -- for instance, inside a cell <"one one onebar"> as <111> with a bar over the third one. Is there any way to type <111> with a bar over the third one in a cell in Excel? Thanks, Joe It looks like my question posted twice. Please ignore this posting. "DrJoe" wr...

Macro confusion
I'm trying to make macro keys that specify a department in the item search and get ready for a name in the search, so I start the macro (ctrl-f3) but it won't let me end the recording until I close the open search window, what am I doing wrong? I tried pausing the recording and closing the windows to no avail! -Jerry It seems like you didn't quite finish the process. You need to ctrl-f3 to start the process, open your window, ctrl-f3 to pause your process, close your window, and then ctrl-f3 one more time to end the macro. The closing of the window will not be recorded. -...

Migrating GP to another Existing Server
Hi, So far I can only managed to find documentation on GP migration to a new server. Is there any documentation on migration to another existing GP Server? We currently have two different MGP systems (1 in the UK and 1 in Singapore) and plan to consolidate them in Singapore. Any help would be appreciated! Cheers, Sugih If you are going to add the UK db to the Singapore server in ONE GP install with 2 companies: 1. Backup the UK company using the SQL backup tool. Take the file to Singapore. 2. On the Singapore GP install, create a new company. Use the same name as the UK compan...

single instance YET ...
Hi, I wish to have my MDI based MFC application to be single instance. Let's assume I use the unique class name method. When my application starts, I check to see if there's already an instance running. If so, I set focus to active instance and terminate. But now I wish this: When a second instance is started with command line parameters, I wish to terminate that instance, but pass the command line parameters to the first instance (a file name, so that it can be openend as another document inside my MDI application). How do I pass this info? Is it possible to pass this via a window...

Extract data on one spreadsheet to another based on criteria
I have a list of data on one worksheet called raw_data coming from an external HR database example below: Month Site Hire Date Name Employee ID January Bedfont 01/01/2007 Andrew 000000001 January Bedfont 05/01/2007 Harry 000000002 January Hams Hall 31/01/2007 Simon 000000003 January Colworth 31/01/2007 Jenner 000000004 January Colworth 31/01/2007 Harry 000000005 February Leeds 09/02/2007 Simon 000000006 February Colworth 10/02/2007 Mavis 000000007 February Colworth 11/02/2007 Harry 000000008 February Hams Hall 12/02/2007 Jenn...

Load event question
I found this code along with it's function on this discussion group. It works great but I want it to populate the text field when the form loads. How can I get the following code on the Form_Load()? fOSUserName() is a defined function. Private Sub Form_BeforeUpdate(Cancel As Integer) On Error GoTo BeforeUpdate_Err ' Set bound controls to system date and time and current user name Me.DateModified = Now() Me.ModifiedBy = fOSUserName() BeforeUpdate_End: Exit Sub BeforeUpdate_Err: MsgBox Err.Description, vbCritical & vbOKOnly, _ &quo...

Excel 2000 macro security Level
Hi! I am running an ASP.NET application which ideally opens an Exce spreadsheet with a macro included in it. When I try opening spreadsheet without a macro, everything works fine, but with macros, i hangs on the opening command. I tried to go to Excel 2000 and go t Tools->Macros->Security Level->Low but it still hangs when I try t open the macro spreadsheet. All works fine with the spreadsheet no containing macros, so it really is a question of macro security. But put it to low, so I don't understand how it is still not opening!! An help would be greatly appreciated! Thanks and...

Referencing Cells in Another Worksheet
I have a worksheet with contact names and numbers and some have a combination of both. I have a Landscape and a Portrait Version. I want to be able to make changes in only one and the other would automatically update. It worked when I first created it using "=", but for some reason, when I inserted some lines and deleted others, the cells stopped working. I tried to fix, but no luck. I've also tried changing both formats to General and number and neither worked. Please help.... thank you! ...

workbook will calculate on one PC but not another
Using xl2002, I created a workbook. it contains a circular reference. i created a workbook_open procedure that appears to have eliminated the problem on my PC... Application.MaxChange = 0.001 ActiveWorkbook.PrecisionAsDisplayed. when i open the workbook on my pc it opens right up, and works. on other PCs, a message appears... "Microsoft Excel cannot calculate a formula. Cell references in the formula refer to the formula's result, creating a circular reference......." Why does the workbook work fine on my PC, and not on others? What can I do to make it work universally? Than...

Update KB 977165 is it safe yet?
I have had updates turned off since the news of the buggy BSOD causing update on Feb 9. Has MS fixed this yet? regards -- Craig News wrote: > I have had updates turned off since the news of the buggy BSOD causing > update on Feb 9. Has MS fixed this yet? The 'problem' - AFAIK anyway - turned out to be infected/infested machines. If your machine is not infested/infected, in particular with: Win32/Alureon.A http://www.microsoft.com/security/portal/Threat/Encyclopedia/Entry.aspx?Name=Virus%3AWin32%2FAlureon.A More information on the ongoing i...

Macro info please
We have our price lists in worksheets - and every so often we need to adjust the prices - the prices are in columns within the worksheet, but in different columns within the same worksheet. Is there an easy way to adjust these prices (either up or down (!)) by running a macro ? My thanks in anticipation. If it is a uniform increase/decrease, you can enter the multiplier in a cell, then copy it to the clipboard. Then select all the target cells, and Edit>PasteSpecial>Multiply. Clear the multiplier and you are done. -- --- HTH Bob (there's no email, no snail mail, but some...