Consulting

Results 1 to 6 of 6

Thread: Place format under each date

  1. #1
    VBAX Expert Shazam's Avatar
    Joined
    Sep 2005
    Posts
    530
    Location

    Place format under each date

    Hi everyone,



    Is it possible to place a certain format under each date in the worksheet and filldown the format to the last cell in column A. The reason why because the dates are not set in thoses columns it fluctuates to column to column.

    The format I would like is:

    Accounting 0.00


    Any help will be great.
    Last edited by Shazam; 07-19-2006 at 08:21 AM.

  2. #2
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    Shazam, sorry, are you talking of Dates or data?
    Do you just want the format in Column "A"?

  3. #3
    VBAX Master Norie's Avatar
    Joined
    Jan 2005
    Location
    Stirling, Scotland
    Posts
    1,831
    Location
    Shazam

    Do you mean you want to format each cell in the columns with dates in row 1 as Accounting?

  4. #4
    VBAX Expert Shazam's Avatar
    Joined
    Sep 2005
    Posts
    530
    Location
    Quote Originally Posted by Norie
    Shazam

    Do you mean you want to format each cell in the columns with dates in row 1 as Accounting?
    Yes,

    So far I got this and it works. It looks for the text "Last Week" and place the format minus one column where the dates are at.


     
        With ActiveSheet
            lastRow = .Cells(.Rows.Count, 1).End(xlUp).Row
            Set yRng = .Range("2:2")         Set y = yRng.Find("Last Week")
            Set rngFirst = y
            Do
                Set y = yRng.FindNext(y)
     
            Range(y.Offset(0, -1), .Cells(lastRow, y.Column - 1)).NumberFormat = _
    "_(* #,##0.00_);_(* (#,##0.00);_(* ""-""??_);_(@_)"
           Loop Until y.Address = rngFirst.Address
        End With
    Edited 20-Jul-06 by geekgirlau. Reason: insert line breaks

  5. #5
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Shazam, It's the VBA tags you need to use, along with the line breaks. Regards MD
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  6. #6
    VBAX Expert Shazam's Avatar
    Joined
    Sep 2005
    Posts
    530
    Location
    Quote Originally Posted by mdmackillop
    Hi Shazam, It's the VBA tags you need to use, along with the line breaks. Regards MD

    Thanks mdmackillop I'm keep forgetting to use that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •