+ Reply to Thread
Results 1 to 2 of 2

Adding a row with a Macro and Defined Area

  1. #1
    Registered User
    Join Date
    07-12-2013
    Location
    Raleigh, NC
    MS-Off Ver
    Excel 2013
    Posts
    1

    Adding a row with a Macro and Defined Area

    I'm currently using this Macro to add a row into a sheet:

    Sub AddARow()
    Dim varUserInput As Variant
    varUserInput = InputBox("Enter Row Number where you want to add a row:", _
    "What Row?")
    If varUserInput = "" Then Exit Sub

    RowNum = varUserInput
    Rows(RowNum & ":" & RowNum).Insert Shift:=xlDown
    Rows(RowNum - 1 & ":" & RowNum - 1).Copy Range("C" & RowNum)
    Range(RowNum & ":" & RowNum).ClearContents
    End Sub

    I actually need the macro to add a defined area "reciperow" into the sheet at the inputted rownum and start at column c. Anyone help me out on this?

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,199

    Re: Adding a row with a Macro and Defined Area

    Hi, cbarbera,

    the compiler should throw up an exception because I doubt it to be possible to enter the data of an entire row starting at the third column in another row.

    Please Login or Register  to view this content.
    Please use code-tags if you show your code here in the forum.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro to stop you from adding column, rows in choosen area in excel sheet
    By olwy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-17-2013, 05:39 AM
  2. Sum of a row in a defined area
    By Eskil in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-09-2012, 06:37 PM
  3. Replies: 2
    Last Post: 05-16-2010, 11:23 PM
  4. Replies: 8
    Last Post: 05-23-2007, 06:39 AM
  5. Adding a character to a defined name with a formula or macro
    By InfinityDesigns in forum Excel General
    Replies: 20
    Last Post: 06-24-2005, 02:05 AM

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