+ Reply to Thread
Results 1 to 5 of 5

Please explain this macro for cutting rows

  1. #1
    Registered User
    Join Date
    01-22-2014
    Location
    Compton, whup whup
    MS-Off Ver
    Excel 2010
    Posts
    108

    Please explain this macro for cutting rows

    Could someone please explain the concepts and each piece of the macro below. In as much detail as possible!! A couple specific questions: 1) What is Const? 2) What are the pieces of the "find" 3) What does "If Not is nothing" mean? And many more!!




    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    10-01-2013
    Location
    Houston
    MS-Off Ver
    Excel 2010
    Posts
    136

    Re: Please explain this macro for cutting rows

    Highlight each word in the code and hit F1
    The help menu will help you a lot. Note that the help menu has example illustrations also. For example: Highlight Const and click F1. The help menu will pop up
    Last edited by vnzerem; 01-27-2014 at 02:34 PM.

  3. #3
    Forum Expert
    Join Date
    11-28-2012
    Location
    Guatemala
    MS-Off Ver
    Excel 2010
    Posts
    2,394

    Re: Please explain this macro for cutting rows

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Please explain this macro for cutting rows

    my thoughts:

    Please Login or Register  to view this content.

  5. #5
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Please explain this macro for cutting rows

    Hopefully this makes sense
    Please Login or Register  to view this content.
    This assigns the word to search for - const allows you to use it anywhere within code and it does not change
    Please Login or Register  to view this content.
    Setting the variable types ie: ranges numbers, string of text
    Please Login or Register  to view this content.
    this will use find in sheet1, coloumn A to find the word "purchasing"
    if its found it will set R as the range found


    Please Login or Register  to view this content.
    then use an if statement to check if the word was found
    This is working in reverse ie; if R is found then do this

    Please Login or Register  to view this content.
    Assigns the found range address to a variable
    Please Login or Register  to view this content.
    assigns the found range but starts 1 row above as the first cell then increases the range to 4 rows deep x the number of columns used in the used range surroundung that cell
    Please Login or Register  to view this content.
    Then loop through the rest of column to find anymore examples of the word "purchasing"

    Please Login or Register  to view this content.
    if no more examples found exit the loop
    Please Login or Register  to view this content.
    if the next found example is the same as the original ie; one found only then exit loop
    Please Login or Register  to view this content.
    otherwise assign the cell where the 2 ranges cross
    Please Login or Register  to view this content.
    Exit the loop
    Please Login or Register  to view this content.
    If the ctRng was found then
    Please Login or Register  to view this content.
    assign a variable
    Please Login or Register  to view this content.
    loop through each cell in the cutRng
    Please Login or Register  to view this content.
    cut the cell and paste it in the next sheet
    Please Login or Register  to view this content.
    find the next row ready for the next loop/cell
    Please Login or Register  to view this content.
    end loop
    Please Login or Register  to view this content.
    Regards
    Sean

    Please add to my reputation if you think i helped
    (click on the star below the post)
    Mark threads as "Solved" if you have your answer
    (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code:
    [code] Your code here [code]
    Please supply a workbook containing example Data:
    It makes its easier to answer your problem & saves time!

+ 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] Excel Macro for Cutting Rows based upon Column B into new Tabs in the same workbook
    By paulzzed in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2012, 02:49 AM
  2. Cutting the same data from different rows and pasting them into the same rows
    By Sal1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-05-2010, 05:22 PM
  3. 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
  4. Cutting/Pasting Rows based on content PT 2
    By Lmsloman in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 09-21-2006, 06:36 AM
  5. Cutting Nonadjacent Rows
    By RJ in forum Excel General
    Replies: 2
    Last Post: 08-08-2005, 04:05 PM

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