|
-
Nov 8th, 2005, 04:24 PM
#1
Thread Starter
New Member
Help with formatting methods?
Hi there,
I'm very new at this so please bear with me....
I'm trying to find a method to color the background cells in my worksheet, format a cell so that it displays the date in the following format: "Nov-2005", and finally to format the number of decimal places displayed in some selected cells. Any ideas?
For the date problem, I'm not sure if I'm on the right track :
.range("A1").numberformat = " ????? "
Similarly for the decimal places prob, should I be using the .numberformat method??
Any help would be appreciated.
-
Nov 8th, 2005, 04:44 PM
#2
Re: Help with formatting methods?
 Originally Posted by Beaver
I'm trying to find a method to color the background cells in my worksheet
To set the background colour to red...
VB Code:
Range("A1").Interior.ColorIndex = 3
 Originally Posted by Beaver
...format a cell so that it displays the date in the following format: "Nov-2005",...
VB Code:
Range("A1").NumberFormat = "mmm-yyyy"
 Originally Posted by Beaver
...to format the number of decimal places displayed in some selected cells.
Examples
for 2 decimal places with commas use
VB Code:
Range("A1").NumberFormat = "#,##0.00"
for 3 decimal places without commas
VB Code:
Range("A1").NumberFormat = "0.000"
Just change the range reference to which ever cells you need to format.
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
Nov 9th, 2005, 08:14 AM
#3
Frenzied Member
Re: Help with formatting methods?
I don't know if you've discovered this yet or not, but just in case not, here are a couple of examples of referencing cells programatically:
Code:
Option Explicit
Sub Macro1()
Dim aRow As Long
Dim aColumn As Long
aRow = 2
aColumn = 3
Cells(aRow, aColumn).Interior.ColorIndex = 3 'Cell C2
' -- or like this --
Cells(3, "B").Value = "TEST" 'Cell B3
End Sub
Good Learning and Good Programming!
Blessings in abundance,
All the Best,
& ENJOY!
Art . . . . Carlisle, PA . . USA
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|