+ Reply to Thread
Results 1 to 2 of 2

VBA Copy and Paste Rows if Condition is Met

  1. #1
    Registered User
    Join Date
    02-28-2016
    Location
    Wolverhampton,England
    MS-Off Ver
    2013
    Posts
    6

    VBA Copy and Paste Rows if Condition is Met

    Hi, I have the following spreadsheet (see attached), I want to be able to produce two new rows after every row which contains the word "Principal" in Column B. Furthermore, I would like the two new rows to contain the same information as the row preceding the row which contains word "Principal", based on the condition if the row preceding the row contains the word "Principal" has the word "General" in column B, if it does not then I would like the two new rows to be blank.

    Is there a way to do this in VBA, i.e. via a loop

    Anyone's advice would be very much appreciated!
    Attached Files Attached Files
    Last edited by Nav8569; 10-07-2019 at 05:41 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,873

    Re: VBA Copy and Paste Rows if Condition is Met

    Because your file is many rows long, I would urge you to test this on a smaller sample to ensure that I have understood your needs properly before applying to the full worksheet. I tested on a smaller version of your file (~25 lines)

    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ 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. VBA using for-next loop to produce following output
    By pinkalpaca in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-22-2016, 12:42 PM
  2. Hierachy structured nested loop (next row) to produce a value
    By Sc0tt1e in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-30-2016, 08:34 AM
  3. [SOLVED] Button Function to Produce New Rows
    By Bargyy in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-14-2016, 12:49 PM
  4. Concatenate Multiple Rows to Produce Different String Combos?
    By boba7523 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-29-2015, 02:49 AM
  5. macro to produce records reaches maximum rows
    By mrroling2000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-10-2011, 05:51 PM
  6. Do I need a control loop to produce worksheet?
    By QuickLearner in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-28-2006, 06:30 AM
  7. produce a formulate to produce assigned seats for dinner
    By DavidJoss in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-03-2005, 10: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