Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 27th, 2006, 09:43 AM
Registered User
 
Join Date: Jul 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Macro script to select a row

I am trying to create a macro and am not finding the macro language that I would need to insert a line. This language will be inside a loop that I have already created.
I have a set of data with 6 columns, and am at cell B2. In the macro, I want to move down two rows, select the entire row, then insert a blank row above the selected row. Here is what I currently have, but is it not working. Not sure if it is moving down two rows, and not sure if it is selecting the row.

Rows(2).Select
Selection.Insert Shift:=xlDown

If someone can send the proper instructions to get this part of the macro to work, it would be much appreciated.
 
Old July 27th, 2006, 04:13 PM
Authorized User
 
Join Date: Jul 2006
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Sub LINIA1()
Cells(2, 2).Select ' CELL "B2"
Rows(ActiveCell.Row + 2).Select ' MOVE DOWN TWO ROWS AND SELECT ROW
Selection.Insert Shift:=xlUp 'INSERT A BLANK ROW ABOVE
End Sub





Similar Threads
Thread Thread Starter Forum Replies Last Post
Select row in GridView WITHOUT using Select button rao965 ASP.NET 2.0 Professional 1 February 15th, 2008 10:44 AM
execute xl macro in DTS 2000 activex script task ismailc SQL Server DTS 1 December 14th, 2007 10:14 AM
limiting a macro to terminate after row 600 gauravhyd Excel VBA 1 May 29th, 2007 09:21 AM
Select row number N 1kHz SQL Language 4 December 27th, 2004 06:22 AM
SELECT COUNT as a ROW?? t0ny SQL Language 3 December 8th, 2004 05:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.