+ Reply to Thread
Results 1 to 6 of 6

Cut and paste a range of cells based on user input

  1. #1
    Registered User
    Join Date
    04-25-2015
    Location
    RICHMOND CA
    MS-Off Ver
    2010
    Posts
    9

    Cut and paste a range of cells based on user input

    Hello,


    I'm new to VB and was looking for some help, any input would be greatly appreciated...


    the cells A1 to H1 contain a bunch of values:

    1 11 59 35 33 46 12 18

    I need a code that allow the user to add a number to that list and also specify where it goes..

    B3= what number to add
    B4= after which number

    example :

    1 11 59 35 33 46 12 18

    B3= 60
    B4= 59



    the result should look like this


    1 11 59 60 35 33 46 12 18




    Like I said, any help is greatly appreciated....thx
    Last edited by MICHAEL BIZ; 08-23-2015 at 06:09 PM.

  2. #2
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Cut and paste a range of cells based on user input

    One way,

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-23-2015
    Location
    Spain
    MS-Off Ver
    2007
    Posts
    32

    Thumbs up Re: Cut and paste a range of cells based on user input

    Here you go !
    Please Login or Register  to view this content.
    Last edited by FerJo; 08-23-2015 at 06:27 PM. Reason: forgot to declare a var! :)
    May the REPUTATION be with me

  4. #4
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: Cut and paste a range of cells based on user input

    Here's another possibility.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-25-2015
    Location
    RICHMOND CA
    MS-Off Ver
    2010
    Posts
    9

    Re: Cut and paste a range of cells based on user input

    Thank you ALL very much for your help, both Fergo and Skywriters codes worked well, but skywriter's code allows me to input letter in also which is what I need. the Berlan solution did not work for me but thanks for helping...
    Last edited by MICHAEL BIZ; 08-24-2015 at 12:15 PM.

  6. #6
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: Cut and paste a range of cells based on user input

    Michael,

    I forgot about one of the behaviors that the find method has. If the first two numbers A1 and B1 were the same and your intention was to put the new number after A1 my code will in fact put it after B1. It's an easy fix.This is the modified code you should use.

    Thanks for the rep. points.

    Good Luck.

    Please Login or Register  to view this content.

+ 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. [SOLVED] Need to let User intput the range row value based on input box
    By bconner in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-03-2014, 04:13 PM
  2. [SOLVED] Copy paste specific row of data based on user input
    By jjsiow in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-23-2014, 11:59 AM
  3. Replies: 4
    Last Post: 02-25-2013, 06:43 PM
  4. [SOLVED] In copy/pasting cells to a new sheet cannot automate cells (1, x) based on user input
    By CEDarnell in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-05-2012, 06:08 PM
  5. Sum a range of cells based on user input
    By coachdave in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-03-2009, 10:23 PM
  6. Macro to define name range based on user input
    By truongn2 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-03-2007, 08:53 PM
  7. user input of a range of cells
    By naz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-11-2006, 12:05 AM

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