1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Excel Marco and Subtotal function issues

Discussion in 'Business Applications' started by rarodrig, Jun 20, 2012.

Thread Status:
Not open for further replies.
  1. rarodrig

    rarodrig Thread Starter

    Aug 2, 2002
    Hi using Win 7 Excel 2007.

    I have a multi-sheet workbook. When I did a "subtotal" on one sheet, Excel created new columns (1,2,3) for those subtotals.

    When I copy a row(s) from this sheet to another, Excel insert these new columns on the new sheet.

    (1) I just want the data from that row, I don't what the subtotal columns on the new sheet! How do I turn off these subtotal columns?

    (2) question: I'm using a MACRO to copy the data row(s) from the first sheet to the second. When I open the Excel,
    It has a "security Warning Macros have been disabled." message. What do I need to change to have the Workbook open with Marcos enable? Also does it matter if my Marco is "private" or not? Now it's not private.

  2. Keebellah

    Keebellah Hans Trusted Advisor

    Mar 27, 2008
    Hi, the macro security question is a setting in your excel.
    You have to open Excel's options window and look for 'Trust Center" and then "Trust Center Settings", here you can specify what you want Excel to consider trusted.
    There isn optionTrusted Locations, here you can indicate the Files with macro's that are stored here are trusted so the warning will not appear.

    Well, if you're using a macro to copy the data rows you must exclude those columns.
    I have no idea why it's in a column but that's your show.

    You will need to edit the macro to selct only those rows that you want copied without the sub total columns.

    If it were subtotal rows then you must exclude the subtotal rows.

    BTW: You should try the Excel help function and look for Truste Center, that helps too
  3. rarodrig

    rarodrig Thread Starter

    Aug 2, 2002
    Thanks Keebellah, Trusted Locations solved the security/Macro problem.

    The Column issue: "the columns" that are added are not regular excel columns. These are shadow columns added by the subtotal function that just contain the subtotal brackets which show the grouping of the subtotals groups. I just converted the subtotal cells to =SUM() function. But the shadow columns didn't go away.

    I just copied the data from the source into into another sheet without Subtotal which fixed that sheet,
    BUT the target sheet still has those SUBTOTAL generated columns.
  4. Garf13LD


    Apr 17, 2012
    Add a line target_range.removesubtotal after you pasted.
  5. rarodrig

    rarodrig Thread Starter

    Aug 2, 2002
    Here's my code. I got it from someone. So I really don't know how it works. Where would I add the new line?

    Sub importActiveOptions()
    Dim myCopyRow, myPasteRow As Integer

    myCopyRow = 3
    myPasteRow = 100

    With Worksheets("OptionSum")
    Do While .Cells(myCopyRow, 1) <> "EOF"
    If .Cells(myCopyRow, 1) <> "active" Then
    GoTo Continue
    End If
    Worksheets("GainLoss").Paste Destination:=Worksheets("GainLoss").Rows(myPasteRow)
    myPasteRow = myPasteRow + 1
    myCopyRow = myCopyRow + 1
    End With
    End Sub
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1057885