+ Reply to Thread
Results 1 to 4 of 4

Macro needed for a new row and a new column.

Hybrid View

  1. #1
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887
    Not sure if this is what you're after, but making some assumptions it might work. This code inserts a row above the current cell then inserts a space character into columns A:X of that new row. It then inserts a column to the left of the active cell and inserts a space character in the first 100 cells in that column.
    Sub insertRC()
        ActiveCell.EntireRow.Insert
        Range(Cells(ActiveCell.Row, 1), Cells(ActiveCell.Row, 24)).Value = " "
        ActiveCell.EntireColumn.Insert
        Range(Cells(1, ActiveCell.Column), Cells(100, ActiveCell.Column)).Value = " "
    End Sub
    If that's not what you're looking for you will need to provide more details.

  2. #2
    Registered User
    Join Date
    05-26-2008
    Posts
    28

    Thanks all - Problem solved

    Thanks PjoAcquin. It worked. But i want to ask this:

    Why does running this macro twice give error?

     
    Sub fill_final()
    '
    ' fill_final Macro
    ' Macro recorded 11/3/2008 by ***.
    '
    ' Keyboard Shortcut: Ctrl+Shift+E
    '
    Range("A1:V100").Select
    Selection.SpecialCells(xlCellTypeBlanks).Select
    ' error in above line
    Selection.FormulaR1C1 = " "
    End Sub
    Is it because there is no blank cell to select?
    How can I modify the code so that I don't get an error if I repeat run the macro.

    Best,
    Charles.
    Last edited by VBA Noob; 11-06-2008 at 04:08 PM. Reason: Added code tags as per forum rules

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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