+ Reply to Thread
Results 1 to 5 of 5

cutting and moving a row based on a value in a cell

  1. #1
    Registered User
    Join Date
    08-07-2013
    Location
    Wellington, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    6

    cutting and moving a row based on a value in a cell

    Hi there,

    I'm a newcomer to the wonderful world of excel and am trying to use macros to automate otherwise tiresome labour. I've had some success using record macro to replicate my actions, but I now have some macros that I want to be a bit more generic that I'm having trouble with.

    I have a worksheet that is split into 4 separate sections. The number of rows in each section will vary from day to day and week to week.

    I'm trying to create a macro (to be activated by a button) that will search a column (G) in one section and if a cell (for example G7) has a certain value (for example 'withdrawn') then it will cut that entire row and relocate it to another section.

    Now, so far I have been able to get it adding into the other section absolutely fine, but I just can't get my head around how to get it to identify the rows to move.

    So essentially I'm looking for a macro to identify the row and cut it and then the existing code can do the rest. There are about 10 possible values that cell could contain where I would want it to be cut. The way the spreadsheet is used there will only be one row in that section which contains one of those values.

    I've been searching the web for a couple of days for solutions and have not be able to find someone else with the same request or understand similar macros well enough to adapt them to my purpose so any assistance would be greatly appreciated.

  2. #2
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: cutting and moving a row based on a value in a cell

    Hi Crangiopharengoma,

    welcome to the forum.
    Feel free to look around and try to use the search function
    I did that and it came up with this : http://www.excelforum.com/excel-prog...ell-value.html
    Might help you with your request.
    Please click the * below if this helps

  3. #3
    Registered User
    Join Date
    08-07-2013
    Location
    Wellington, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: cutting and moving a row based on a value in a cell

    The difficulty I've been having is with having multiple variables in the cell that I want to cut. So in that example the variable is 'dbo' and only 'dbo'. In my case the variable could be one of 10 things and I have not been able to figure out how to get it to search for those 10 values.

  4. #4
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: cutting and moving a row based on a value in a cell

    list your ten things as follows :
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-07-2013
    Location
    Wellington, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: cutting and moving a row based on a value in a cell

    Ah I had been trying to use the or function after the value = rather than the whole range statement.

    I've also found one other issue, where 1row = .Range("A" & .Rows.Count).End(xlUp).Row is causing the macro to search the entire worksheet when I really want it to search only a specific area.

    The specific area is a row that is named area called 'adder'. At the moment that is row 9, but it will vary (both higher and lower). I've been trying to replace .Rows.Count but I keep getting errors. Can I use that named area as a reference in this macro?

+ 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. Inserting, Cutting, and Pasting Rows Based on What's in a Cell
    By 4EverLearning in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-05-2010, 04:42 PM
  2. Replies: 7
    Last Post: 07-09-2010, 09:57 AM
  3. Replies: 4
    Last Post: 03-28-2005, 05:06 PM
  4. Replies: 7
    Last Post: 03-27-2005, 08:06 PM
  5. [SOLVED] Help Please Cutting and pasting based on cell value
    By Mike in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-18-2005, 10:06 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