+ Reply to Thread
Results 1 to 4 of 4

Add format to VBA

  1. #1
    Forum Contributor
    Join Date
    03-08-2007
    Location
    St. Augustine, Fl
    MS-Off Ver
    Excel 2021 for Mac
    Posts
    392

    Add format to VBA

    I would like to have Column A & E formatted as date, Columns B, C, General, F-K as Currency, and A-K as Comic Sans MS 16

    [CODE]Dim WS1 As Worksheet, WS4 As Worksheet
    Dim LastRow As Long
    Dim rngCopy As Range, rngSpecialPaste As Range

    Set WS1 = Worksheets("Invoice")
    Set WS4 = Worksheets("Jan_21")

    With WS4

    LastRow = .Cells(Rows.Count, 1).End(xlUp).Row
    .Range("K9:K" & LastRow).Formula = "=SUM(F9:J9)"
    .Cells(LastRow + 1, 1).Resize(1, 4).Value = Array(WS1.Range("E3"), WS1.Range("E5"), WS1.Range("E4"), Range("InvTot"))
    End With

    With ActiveSheet
    Set rngCopy = .Range(.Range("A9:C9"), .Cells(1, Columns.Count).End(xlToLeft))
    Set rngPaste = .Range(.Range("A10:C10"), .Cells(Rows.Count, 1).End(xlUp)).Resize(, rngCopy.Columns.Count)
    End With
    CODE]
    Last edited by Wskip49; 11-13-2020 at 01:26 PM.

  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
    44,764

    Re: Add format to VBA

    I would like to have Column A & E formatted as date, Columns B, C, General, F-K as Currency, and A-K as Comic Sans MS 16
    Record a macro while you format the columns as you require them. Copy the recorded code into your current macro.
    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
    03-08-2007
    Location
    St. Augustine, Fl
    MS-Off Ver
    Excel 2021 for Mac
    Posts
    392

    Re: Add format to VBA

    Thanks so much
    Last edited by Wskip49; 11-13-2020 at 01:25 PM. Reason: Solved

  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
    44,764

    Re: Add format to VBA

    You're welcome.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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. Replies: 5
    Last Post: 01-25-2020, 05:18 PM
  2. Format cells based on 2 separate cell data, incorporated into the format
    By Laur_E in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-11-2019, 01:57 AM
  3. Replies: 3
    Last Post: 02-24-2015, 02:58 AM
  4. Replies: 5
    Last Post: 04-01-2014, 09:37 AM
  5. Replies: 3
    Last Post: 05-15-2013, 12:16 AM
  6. Replies: 1
    Last Post: 09-10-2005, 05:05 AM
  7. Replies: 1
    Last Post: 01-31-2005, 09:06 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