Questions

Formatting VBA Code or Macro in Excel

Tags:
+
0 Votes
Locked

Formatting VBA Code or Macro in Excel

Dayle1011
I am creating a spreadsheet where I have subtotals. However, I want to add subtotal underscore lines to establish an "accounting" formatting. Does anyone know how to create a MACRO or VBA code to accomplish this?

Thank you :)
  • +
    0 Votes
    Tink!

    Because otherwise you wouldn't need a Macro.

    Do you just want a single line under the subtotal? If so, it's usually easiest to use the thin line border on the bottom of the cell containing the subtotal. Located in Format, Cells, click the Border tab. If you have the Formatting Toolbar visible, there is a Cell Border button that usually defaults to the bottom line, but you can also click it and select which pre-selected border you want.

    If you still need a macro please let us know.

    +
    0 Votes
    Dayle1011

    Hi Tink,
    Thank you for your reply. Yes this is for automation, however, I need the double underline and the single line to format the subtotals. Now the problem is that there are multiple line items since the subtotal feature has been used. Will a macro just run on the line items listed?

    +
    0 Votes
    Tink!

    Ok. I'm still questioning the need for a macro. Maybe a few more details would help clarify things.

    Is this sheet going to always change in length?

    Or is the number of lines/entries always going to be the same - so the subtotal line stays in the same cell always?

    If the Subtotal feature is creating extra lines - perhaps it's best not to use it, but instead setup your own Sum formulas to include the line items you want. Does this sound better? I can help you further if you need it.

  • +
    0 Votes
    Tink!

    Because otherwise you wouldn't need a Macro.

    Do you just want a single line under the subtotal? If so, it's usually easiest to use the thin line border on the bottom of the cell containing the subtotal. Located in Format, Cells, click the Border tab. If you have the Formatting Toolbar visible, there is a Cell Border button that usually defaults to the bottom line, but you can also click it and select which pre-selected border you want.

    If you still need a macro please let us know.

    +
    0 Votes
    Dayle1011

    Hi Tink,
    Thank you for your reply. Yes this is for automation, however, I need the double underline and the single line to format the subtotals. Now the problem is that there are multiple line items since the subtotal feature has been used. Will a macro just run on the line items listed?

    +
    0 Votes
    Tink!

    Ok. I'm still questioning the need for a macro. Maybe a few more details would help clarify things.

    Is this sheet going to always change in length?

    Or is the number of lines/entries always going to be the same - so the subtotal line stays in the same cell always?

    If the Subtotal feature is creating extra lines - perhaps it's best not to use it, but instead setup your own Sum formulas to include the line items you want. Does this sound better? I can help you further if you need it.