#1   Report Post  
Posted to microsoft.public.excel.misc
danh
 
Posts: n/a
Default Macro Commands

Thanks for your help. I will try your VBA Code as it seems to be exactly
what I need
Danielle

"DCSwearingen" wrote:


Try this:
'------------------
Option Explicit
'------------------
Private Function FindLastCell()
Dim lCell As String
Range("A1").Select
lCell = ActiveCell.SpecialCells(xlLastCell).Address
FindLastCell = lCell
End Function
'------------------
Private Sub CondFormat()
Dim cFormat As String, cCell As String, tRange As String, c As Range
Dim lCell As String, lRow As Long, lCol As Long
lCell = FindLastCell
lRow = Range(lCell).Row
lCol = Range(lCell).Column
tRange = "$A$1:" & lCell
For Each c In Range(tRange)
cFormat = "=$G$" & c.Row & "=""W"""
c.FormatConditions.Add Type:=xlExpression, Formula1:=cFormat
c.FormatConditions(1).Font.ColorIndex = 2
c.FormatConditions(1).Interior.ColorIndex = 13
Next
tRange = Cells(lRow, 1).Address
tRange = "$A$1:" & tRange
For Each c In Range(tRange)
cFormat = "=$G$" & c.Row & "=""B"""
c.FormatConditions.Add Type:=xlExpression, Formula1:=cFormat
c.FormatConditions(2).Font.Bold = True
Next
End Sub


--
DCSwearingen

Getting old, but love computers.
------------------------------------------------------------------------
DCSwearingen's Profile: http://www.excelforum.com/member.php...o&userid=21506
View this thread: http://www.excelforum.com/showthread...hreadid=552671


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
Editing a simple macro Connie Martin Excel Worksheet Functions 5 November 29th 05 09:19 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
macro with F9 Kenny Excel Discussion (Misc queries) 1 August 3rd 05 02:41 PM
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM


All times are GMT +1. The time now is 12:42 AM.

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"