Results 1 to 3 of 3

Add row at specific location using vba

Threaded View

hrbreton Add row at specific location... 02-05-2011, 02:53 PM
Leith Ross Re: Add row at specific... 02-05-2011, 04:36 PM
hrbreton Re: Add row at specific... 02-06-2011, 01:59 PM
  1. #1
    Registered User
    Join Date
    02-05-2011
    Location
    Ottawa
    MS-Off Ver
    Excel 2003
    Posts
    2

    Add row at specific location using vba

    Hi All,

    I have a spreadsheet (testing - attached) that has several sections with buttons that add and remove rows for that section. In my attached spreadsheet, the add button is only functional for Objectives. My code adds a new row after whatever cell is selected. I need it to go to a cell I've named "OBJ", select the row above it, copy and paste so the cell "OBJ" gets moved down to the next row (to be used if another row is added). The code I have so far is below, it copies the selected row and adds a new row below it, not quite what I am looking for:
     Sub AddRowDeleteConstants()
     On Error GoTo NoConstants
       With ActiveCell.EntireRow
          .Copy
          .Insert Shift:=xlDown
          .SpecialCells(xlCellTypeConstants).ClearContents
        End With
      Exit Sub
    NoConstants:
     MsgBox "There were no constants to delete"
    End Sub
    Any help would be greatly appreciated.

    Thanks.
    Attached Files Attached Files
    Last edited by Leith Ross; 02-05-2011 at 03:47 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1