+ Reply to Thread
Results 1 to 6 of 6

Insert row + copy cell formula's error

Hybrid View

  1. #1
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Insert row + copy cell formula's error

    you have some merged cells in column A, you can not select a single row with them.
    eliminate column A, the your code works without errors
    but you can solve with
    Sub InsertRowsAndFillFormulas(Optional vRows As Long = 0)
       Dim x As Long
       r = ActiveCell.Row
       Range("B" & r & ":D" & r).Select
       If vRows = 0 Then
        vRows = Application.InputBox(prompt:= _
          "How many rows do you want to add?", Title:="Add Rows", _
          Default:=1, Type:=1) 'Default for 1 row, type 1 is number
        If vRows = False Then Exit Sub
       End If
       Range("B" & r + 1 & ":D" & r + vRows).Insert
       Selection.AutoFill Selection.Resize( _
         rowsize:=vRows + 1), xlFillDefault
    End Sub
    Last edited by patel45; 04-22-2013 at 09:04 AM.
    If solved remember to mark Thread as solved

+ Reply to Thread

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