+ Reply to Thread
Results 1 to 9 of 9

VBA Extend Formula To Multiple Columns

  1. #1
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    VBA Extend Formula To Multiple Columns

    Hi, I wonder whether someone may be able to help me please.

    The extract of code below adds a subtotal to a given range.

    Please Login or Register  to view this content.
    The code that I'm having difficulty with is this part:

    Please Login or Register  to view this content.
    This applies the correct formula to the selected cell but I'm then wanting to apply this formula to the next 12 columns, but I'm not sure how to go about this.

    I just wondered whether someone may be able to lookm at this please and offer some guidance on how I may go about achieving this.

    Many thanks and kind regards

    Chris

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,501

    Re: VBA Extend Formula To Multiple Columns

    Maybe:

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Extend Formula To Multiple Columns

    Hi TMS, thank you for coming back to me on this with the code.

    I've inserted the code, but unfortunately I receive a run time error 13 type mismatch.

    Many thanks and kind regards

    Chris

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,501

    Re: VBA Extend Formula To Multiple Columns

    Please post a sample workbook so there is some structure and data to work with.

  5. #5
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Extend Formula To Multiple Columns

    Hi TMS, thank you for taking the timer to come back to me with this, and my apologies for not replying sooner.

    Please find attached the file you asked for and please run the 'Subtotalsanddelete' macro.

    Many thanks and kind regards

    Chris
    Attached Files Attached Files

  6. #6
    Forum Expert nilem's Avatar
    Join Date
    10-22-2011
    Location
    Ufa, Russia
    MS-Off Ver
    2013
    Posts
    3,377

    Re: VBA Extend Formula To Multiple Columns

    Hi hobbiton73,
    try this
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Extend Formula To Multiple Columns

    Hi @nilem, thank you for taking the time to read my post and for the suggestion. It works perfectly!

    All the best and kind regards

    Chris

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,501

    Re: VBA Extend Formula To Multiple Columns

    Thanks for the rep, although nilem provided the answer in the end.

  9. #9
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Extend Formula To Multiple Columns

    Hi TMS, this is true, but you were kind enough to help from the beginning.

    All the best and kind regards

    Chris

+ 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. can i extend the existing 256 columns to 700 columns
    By catchnanan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-27-2013, 04:55 PM
  2. Extend Number of columns
    By hme in forum Excel General
    Replies: 5
    Last Post: 04-29-2006, 02:16 AM
  3. [SOLVED] Extend Excel Workbook Columns to 366
    By ExcelERATOR in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-31-2006, 08:10 PM
  4. how can I extend number of columns in excel
    By Anupam in forum Excel General
    Replies: 2
    Last Post: 08-08-2005, 10:05 PM
  5. how to extend columns pass IV
    By freakyboy88 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-10-2005, 02:05 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