Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default formatting cells (borders, patterns, etc.)

Is it possible to format a cell using VBA code

My code include the following

DatabaseWorksheet.Cells(DestinationRow, 1).Value = AssignDat

At the time this code is executed the cell is not formatted. How would I modify this code so that, in addition to being populated with AssignDate, borders and a pattern would be added

Thanks

Kevin
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default formatting cells (borders, patterns, etc.)

Here is an example. Just make a manual selection or uncomment the range and
modify to suit.

Sub Addborders()'Make selection and execute
Dim myBorders
Dim i As Integer
myBorders = Array(, xlEdgeLeft, xlEdgeRight, xlEdgeTop, xlEdgeBottom,
xlInsideVertical, xlInsideHorizontal)
For i = 1 To UBound(myBorders)
'Range("h2:J6").Select
With Selection.Borders(myBorders(i))
.LineStyle = xlContinuous
End With
Next
End Sub

--
Don Guillett
SalesAid Software

"Kevin" wrote in message
...
Is it possible to format a cell using VBA code?

My code include the following.

DatabaseWorksheet.Cells(DestinationRow, 1).Value = AssignDate

At the time this code is executed the cell is not formatted. How would I

modify this code so that, in addition to being populated with AssignDate,
borders and a pattern would be added?

Thanks.


Kevin



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default formatting cells (borders, patterns, etc.)

The easiest way to see the code (and the possibilities) is to turn on the
macro recorder (tools=Macro=Record a new macro)

then perform the actions manually.

then turn off the recorder and look at the code.

this will give you the properties, methods and constant arguments you need.
You can then use them in your code.

--
Regards,
Tom Ogilvy


"Kevin" wrote in message
...
Is it possible to format a cell using VBA code?

My code include the following.

DatabaseWorksheet.Cells(DestinationRow, 1).Value = AssignDate

At the time this code is executed the cell is not formatted. How would I

modify this code so that, in addition to being populated with AssignDate,
borders and a pattern would be added?

Thanks.


Kevin



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default formatting cells (borders, patterns, etc.)

Sub FormatRange()
With Worksheets("Ark1").Cells(DestinationRow, 1)
.Value = AssignDate
.Font.Bold = True
.Interior.Color = RGB(255, 255, 0)
....
....
End With
End Sub
-----Original Message-----
Is it possible to format a cell using VBA code?

My code include the following.

DatabaseWorksheet.Cells(DestinationRow, 1).Value =

AssignDate

At the time this code is executed the cell is not

formatted. How would I modify this code so that, in
addition to being populated with AssignDate, borders and
a pattern would be added?

Thanks.


Kevin
.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default formatting cells (borders, patterns, etc.)

Just to mention, the recorder will record settings for all attributes of the
cell. You only need to select those attributes you want to set/change.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
The easiest way to see the code (and the possibilities) is to turn on the
macro recorder (tools=Macro=Record a new macro)

then perform the actions manually.

then turn off the recorder and look at the code.

this will give you the properties, methods and constant arguments you

need.
You can then use them in your code.

--
Regards,
Tom Ogilvy


"Kevin" wrote in message
...
Is it possible to format a cell using VBA code?

My code include the following.

DatabaseWorksheet.Cells(DestinationRow, 1).Value = AssignDate

At the time this code is executed the cell is not formatted. How would

I
modify this code so that, in addition to being populated with AssignDate,
borders and a pattern would be added?

Thanks.


Kevin







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default formatting cells (borders, patterns, etc.)

Thank you all. As always, you have been a great help

Kevin
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Locking only borders and patterns TR Young Excel Discussion (Misc queries) 2 June 5th 09 08:17 PM
two flavors of formatting patterns (border/area vs. line/marker) [email protected] Excel Discussion (Misc queries) 2 November 9th 07 09:42 PM
Conditional Formatting of merged cells, borders don't show correct pablo Excel Discussion (Misc queries) 5 September 21st 06 09:23 PM
How can I lock the formatting (patterns) in Excel? AdrianC Excel Discussion (Misc queries) 1 September 17th 05 11:53 PM
How do I do conditional formatting on number formats not patterns. dave55 Excel Discussion (Misc queries) 2 March 22nd 05 02:21 AM


All times are GMT +1. The time now is 08:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"