Closed Thread
Results 1 to 2 of 2

Multi-step formatting macros with formatting and formulas

  1. #1
    Registered User
    Join Date
    03-19-2013
    Location
    San Antonio, Texas
    MS-Off Ver
    Excel 2010
    Posts
    15

    Multi-step formatting macros with formatting and formulas

    This question is on macros and formatting/formulas.

    I run a daily report on all 7 of our locations, each location has its own separate report. This means the number of data lines can vary widely, so any formula must be flexible enough to catch the data whether it is 5 lines or 150 lines (line # 1 is the header line). I am trying to reduce the number of formatting steps I need to do, before transferring the data into my final reports, by creating macros for multi-step formatting. Can anyone help me with any of the “bumps in the road” I am coming across?

    The report format I have is 8 columns:
    A = blank
    B = customer location (i.e. Q.56829-A)
    C = account #
    D= customer name
    E = order status
    F = service date (date of sale)
    G = service time (time of sale)
    H = hours:mins (since order placed) which comes across in this format: 1/2/1900 7:45:00 AM, but I have it pre-formatted to display as 55:45 (hours:mins)
    I = payment method

    Bump # 1:
    This is one of my steps in the macro ...
    I inserted the blank column A and I want it to display today’s date. If columns B thru I, on the same line, are blank, I want the cell in column A to be blank, too (only fill in column A if there is data on that line).
    The steps I did, in order:
    in cell A2: =IF(B2<>””,TODAY(),””)
    Format column A for date
    Copy A2
    Highlight Column A
    Paste

    But, I need to stop the paste at the first blank line. As a reminder, this is a daily report on 7 different locations, the number of lines will vary on each report, so setting it for a specific number of lines will not work. As a thought, do I need to change the sequence of events? For example, format the column for date before using the formula?

    Bump # 2:
    I sort the data by payment method and hours:mins (largest to smallest). I cut the lines for a specific payment type (purchase order) and place those lines further down the sheet (it needs to be worked with separately). I then need to go back to the non-purchase order lines and re-sort by hours:mins, so the longest times are listed on top (the “purchase order” lines are already sorted by time, from the first sort). I have the initial sorting in a macro, but when I try to program the second sort (separate macro), it re-sorts all of the data, not just the entries I have highlighted (I highlight first, before running the second macro). Is there a way I can program the second sort, in a macro, so it will sort only the lines I have highlighted?

    Bump # 3:
    In column H, I need to format in the number of days since the order was placed, not by hours:mins, if the payment method (column I) says “purchase order”. I am manually entering =DATEDIF(F2,A2,”D”) and format the cells for number, no decimals. Then I copy that down the lines. Logically, I should use =DATEDIF(IF(I:I,”purchase order”)(F2,A2,”D”)) but, it (or variations) do not work. Is there a formula that will automatically format column H if column I says “purchase order”, but will leave the hours:mins if not?

    If all of these steps cannot be done in one macro, I can create as many as needed.

    I apologize for this post being so long, I am just trying to be clear on the steps I need to do. Thank you for your help!

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Multi-step formatting macros with formatting and formulas

    Welcome to the Forum!

    Please take the time to review our rules. There aren't many, and they are all important.Welcome to the Forum, unfortunately:

    This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread:

    http://www.excelforum.com/excel-form...d-numbers.html

    Thread Closed.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Conditional Formatting, Filtering & Quick Step
    By Rob-UK in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-07-2012, 11:36 AM
  2. Conditional Formatting/Multi Use of Formulas
    By IsleTurbo in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-06-2011, 04:56 PM
  3. Replies: 1
    Last Post: 09-14-2010, 03:45 AM
  4. Multi-line Formatting
    By gareth93 in forum Excel General
    Replies: 2
    Last Post: 06-12-2006, 08:35 AM
  5. [SOLVED] Restore all formatting in one step back to a cell?
    By Ava in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-18-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