+ Reply to Thread
Results 1 to 3 of 3

Inserting blank lines and formulae

  1. #1
    Registered User
    Join Date
    05-18-2014
    MS-Off Ver
    Excel 2003
    Posts
    7

    Inserting blank lines and formulae

    Hello,

    I have a worksheet that contains data arrange in fields from columns A to J. The relevant columns for the purposes of the macro are columns B (customer codes) and G (sales values). Column B may contain a single instance of a customer code, or multiple (over 50), depending on how active a customer has been. The worksheet always contains many different customer codes with varying numbers of rows for each customer, sorted by customer. What I'm trying to do is write a macro that will loop through the worksheet and insert a blank line immediately after a change in value of column B (customer code), and in this blank line, insert the customer code in column B (which comes from the cell immediately above), a sum formula for all values within a range that relate to that particular customer in column G, and an IF statement in column J that relates to the SUM formula. The loop concludes when there are no longer values in column B.

    I have managed to insert blank lines on change in values in column B, but am not sure about the best approach for inserting the SUM formula or the IF statement in columns G and J respectively.

    If anything requires clarification, please let me know. Any assistance would be greatly appreciated.

    Thanks very much.
    Peter

  2. #2
    Valued Forum Contributor Hawkeye16's Avatar
    Join Date
    02-27-2013
    Location
    Holland
    MS-Off Ver
    ├┤ Pew Pew
    Posts
    441

    Re: Inserting blank lines and formulae

    To insert a formula you would use something similar to
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The first puts a formula in A1 that sums B2 and C2
    The second is an If statement

    If you need something more in depth please attach a sample workbook or your code within code tags.

  3. #3
    Registered User
    Join Date
    05-18-2014
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Inserting blank lines and formulae

    Hi there,
    I've attached a sample file. It should be a little more clear after looking at the worksheet. My diatribe was
    understandably confusing.
    Thanks,
    Peter
    Attached Files Attached Files

+ 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] inserting two blank lines when based on data in a column
    By El Conquistador in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-08-2013, 02:05 PM
  2. Replies: 3
    Last Post: 04-11-2012, 11:00 AM
  3. Replies: 2
    Last Post: 08-18-2006, 11:41 AM
  4. [SOLVED] inserting formulae
    By rachitprasad@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-09-2006, 09:45 AM
  5. Inserting Blank Lines
    By LPM in forum Excel General
    Replies: 7
    Last Post: 09-14-2005, 03: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