+ Reply to Thread
Results 1 to 6 of 6

Cut Insert row to selected row with inputbox

  1. #1
    Registered User
    Join Date
    08-11-2019
    Location
    Madrid, Spain
    MS-Off Ver
    2018
    Posts
    3

    Cut Insert row to selected row with inputbox

    Hello,

    I'm new to VBA and macros in excel.
    I've been trying to insert a full row in a different one by using an inputbox to select the row I want to move it to.
    For example, if I have a row in line 16, IŽd like to have a macro that allows me to select the whole row, cut it, and insert it by typing the row I want to move it to.
    So far I have this code, but it doesnt work properly (it inserts a blank row after writing in the inputbox):

    Sub Macro1()

    Rows(CStr(ActiveCell.Row)).Select
    Selection.Cut
    Rows(Application.InputBox("Please enter row number.")).Select
    Selection.Insert Shift:=xlDown

    End Sub


    Please, could someone help me?

    Thank you

  2. #2
    Forum Contributor
    Join Date
    05-12-2018
    Location
    Netherlands
    MS-Off Ver
    2016
    Posts
    266

    Re: Cut Insert row to selected row with inputbox

    this helps?

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-11-2019
    Location
    Madrid, Spain
    MS-Off Ver
    2018
    Posts
    3

    Re: Cut Insert row to selected row with inputbox

    It does move the row to the one I want, but it leaves a blank space where it was, and replaces the text of the destiny row instead of moving it down.

    I would need keep all the rows and not leave any blank spaces.

    Thank you anyways

  4. #4
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: Cut Insert row to selected row with inputbox

    Maybe this:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-11-2019
    Location
    Madrid, Spain
    MS-Off Ver
    2018
    Posts
    3

    Re: Cut Insert row to selected row with inputbox

    YES!! That's it! Thank you very much!

  6. #6
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: Cut Insert row to selected row with inputbox

    You're welcome, glad to help, & thanks for the feedback.

+ 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. Advanced Filter, Range selected via InputBox
    By Spy-101 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-20-2018, 05:01 PM
  2. [SOLVED] Closing the InputBox when Cancel is selected
    By Raylou in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-02-2015, 06:49 AM
  3. Replies: 1
    Last Post: 03-15-2014, 05:44 AM
  4. Replies: 0
    Last Post: 05-22-2013, 05:57 AM
  5. InputBox selects active cell, not selected cells?
    By kidmiuso in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-15-2010, 09:50 AM
  6. Deleting selected rows using InputBox?
    By deeppurple247 in forum Excel General
    Replies: 8
    Last Post: 01-28-2007, 02:37 PM
  7. InputBox to capture user selected sheet names?
    By quartz in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-03-2005, 06:55 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