Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default populate conditional formating on a spreadsheet via VBA

Hi all,
I'm running macro on excel file an i need to build conditional
formatting to a large amount of excel,
does anyone have faster way to populate the conditional formatting
beside running 2 "for" in order to populate the data?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default populate conditional formating on a spreadsheet via VBA

Hint: When programming try to record a macro on the excel spreadsheet to find
how excel would perform the task. I did this for conditional formatting and
got this code. It look like excel use range rather than the for. range may
be a quicker way of performing the operation.

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 2/15/2007 by Joel Warburg
'

'
Range("H16:R48").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, _
Formula1:="2", Formula2:="13"
Selection.FormatConditions(1).Interior.ColorIndex = 45
End Sub


"thread" wrote:

Hi all,
I'm running macro on excel file an i need to build conditional
formatting to a large amount of excel,
does anyone have faster way to populate the conditional formatting
beside running 2 "for" in order to populate the data?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default populate conditional formating on a spreadsheet via VBA

Hi Joel

I build something like this inside of the for statments

xlApp.Cells(row, Column).FormatConditions.Delete
xlApp.Cells(row, Column).FormatConditions.Add
Type:=xlExpression, Formula1:="=" & "$" &
ColumnLetter(xlApp.ActiveCell.Column + Column - 1) & "$" & row & "<"
& "$" & ColumnLetter(ActiveCell.Column + Column - 1 + LastColumn) &
"$" & row
xlApp.Cells(row,
Column).FormatConditions(1).Interior.ColorIndex = 3
do you think what you send me will be saficient enough when i need to
do the comparacy between cells?

Joel כתב:
Hint: When programming try to record a macro on the excel spreadsheet to find
how excel would perform the task. I did this for conditional formatting and
got this code. It look like excel use range rather than the for. range may
be a quicker way of performing the operation.

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 2/15/2007 by Joel Warburg
'

'
Range("H16:R48").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, _
Formula1:="2", Formula2:="13"
Selection.FormatConditions(1).Interior.ColorIndex = 45
End Sub


"thread" wrote:

Hi all,
I'm running macro on excel file an i need to build conditional
formatting to a large amount of excel,
does anyone have faster way to populate the conditional formatting
beside running 2 "for" in order to populate the data?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default populate conditional formating on a spreadsheet via VBA

thank you very much it was quite helpfull
thread כתב:
Hi Joel

I build something like this inside of the for statments

xlApp.Cells(row, Column).FormatConditions.Delete
xlApp.Cells(row, Column).FormatConditions.Add
Type:=xlExpression, Formula1:="=" & "$" &
ColumnLetter(xlApp.ActiveCell.Column + Column - 1) & "$" & row & "<"
& "$" & ColumnLetter(ActiveCell.Column + Column - 1 + LastColumn) &
"$" & row
xlApp.Cells(row,
Column).FormatConditions(1).Interior.ColorIndex = 3
do you think what you send me will be saficient enough when i need to
do the comparacy between cells?

Joel כתב:
Hint: When programming try to record a macro on the excel spreadsheet to find
how excel would perform the task. I did this for conditional formatting and
got this code. It look like excel use range rather than the for. range may
be a quicker way of performing the operation.

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 2/15/2007 by Joel Warburg
'

'
Range("H16:R48").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlBetween, _
Formula1:="2", Formula2:="13"
Selection.FormatConditions(1).Interior.ColorIndex = 45
End Sub


"thread" wrote:

Hi all,
I'm running macro on excel file an i need to build conditional
formatting to a large amount of excel,
does anyone have faster way to populate the conditional formatting
beside running 2 "for" in order to populate the data?



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
Populate a spreadsheet from a data set rev Excel Worksheet Functions 1 September 26th 08 05:13 PM
Formating a cell to auto populate Aldo Setting up and Configuration of Excel 1 November 16th 07 01:19 PM
Using a current spreadsheet to populate a new one shadesofsisyphus Excel Discussion (Misc queries) 4 August 9th 06 08:04 PM
Install dates formating using conditional formating? Jerry Eggleston Excel Discussion (Misc queries) 2 November 9th 05 05:49 PM
VB Form to populate spreadsheet. Glenn Robertson Excel Programming 4 February 24th 04 12:10 PM


All times are GMT +1. The time now is 09:33 AM.

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

About Us

"It's about Microsoft Excel"