Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 171
  • Last Modified:

Probable No-Brainer...

I have an array representing sheets a - z (26 sheets, i=0 to 25)

the following code auto fits columns and works:

Worksheets(ArrayList(i)).Columns("A:F").EntireColumn.AutoFit

how the heck do I get it to set Font to Arial, Font-Size=8, columns C&D = $, column E (date format) dd-mm-yyyy (e.g., 19-Nov-2004)...

been at this this 4:30 AM and am getting a little "fuzzy"...

Thanks
Ron
0
ronaldj
Asked:
ronaldj
  • 2
  • 2
1 Solution
 
Tommy KinardCommented:
I recorded some macros that may help


'Change font and size
Sub Macro1()
    Columns("C:C").Select
    With Selection.Font
        .Name = "Arial"
        .FontStyle = "Regular"
        .Size = 8
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ColorIndex = xlAutomatic
    End With
End Sub
Format for currency
Sub Macro2()
    Columns("D:E").Select
    Selection.NumberFormat = "$#,##0.00"
'format for dat
    Columns("F:F").Select
    Selection.NumberFormat = "mm/dd/yy"
End Sub

HTH
dragontooth

0
 
ronaldjAuthor Commented:
Hey dragontooth,

Thanks for the response. I too have the same macros...when I went to try and "iterate" through the array, the font size, style, formats didn't work...my line for "Auto-fit works just fine...obviously not referencing the array correctly for the formatting...that's my problem...
Suggestion(s)?...

Ron
0
 
ronaldjAuthor Commented:
OK, in my battle-axe" approach to programming" this cures" part of my problem...

Worksheets(ArrayList(i)).Columns("A:F").Font.Name = "Arial"
Worksheets(ArrayList(i)).Columns("A:F").Font.Size = "8"

Hope this helps someone who experienced the same dilemna...
0
 
Tommy KinardCommented:
Hi ronaldj

Have you tried it this way

Worksheets(ArrayList(i)).Columns("A:F").select
 With Selection.Font
        .Name = "Arial"
        .FontStyle = "Regular"
        .Size = 8
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ColorIndex = xlAutomatic
    End With
Worksheets(ArrayList(i)).Columns("C:D").select
Selection.NumberFormat = "$#,##0.00"
Worksheets(ArrayList(i)).Columns("E").select
Selection.NumberFormat = "dd/mm/yy"

HTH
dragontooth

0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now