Results 1 to 3 of 3

VBA - Insert row, copy contents of original row except for contents of column A

Threaded View

Royzer VBA - Insert row, copy... 02-20-2012, 07:06 PM
Royzer Re: VBA - Insert row, copy... 02-20-2012, 07:36 PM
smuzoen Re: VBA - Insert row, copy... 02-20-2012, 07:41 PM
  1. #1
    Forum Contributor
    Join Date
    04-29-2010
    Location
    Tallahassee, FL
    MS-Off Ver
    365
    Posts
    100

    Smile VBA - Insert row, copy contents of original row except for contents of column A

    Hi. I am using the code below to insert a row by double-clicking a cell. The code then copies formulas (and apparently dates) from the original row to the new row. Is there any way for me to adjust this code so the cell in column A is blank after the insert? If so, I need it to work like this for all 30+ pages of the workbook. Here's the code I have in ThisWorkbook:

    Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
      'David McRitchie,  2007-09-07    insrtrow.htm on double-click
      '-- will copy more often than  Extend Formulas and Format (tools option)
      Cancel = True
      Target.EntireRow.Copy
      Cells(Target.Row + 1, 1).EntireRow.Insert
      Cells(Target.Row + 1, 1).EntireRow.Select
      ActiveSheet.Paste
      Application.CutCopyMode = False
      On Error Resume Next
      '-- customize range for what cells constants can be removed --
      Intersect(Selection, Range("b:IV")).SpecialCells(xlConstants).ClearContents
      On Error GoTo 0
    End Sub

    Thanks!
    Last edited by Royzer; 02-22-2012 at 11:16 AM.

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