Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 354
Default color bar with pattern macro

Hi all
I know how to color excel bar with different colors using color index. How
can
I add pattern with the same color using macro. Do you know what index
number ?
Thanks
Daniel
  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 235
Default color bar with pattern macro

Assuming a simble bar chart with one series, try something like this . . .

Sub FillPatterns()
ActiveChart.SeriesCollection(1).Select
With Selection
.Fill.Visible = True
.Fill.Patterned Pattern:=msoPatternLightUpwardDiagonal
.Fill.ForeColor.SchemeColor = 15
.Fill.BackColor.SchemeColor = 4
End With
End Sub

You can change the pattern type, forecolor, and backcolor.

--
John Mansfield
http://cellmatrix.net





"Daniel" wrote:

Hi all
I know how to color excel bar with different colors using color index. How
can
I add pattern with the same color using macro. Do you know what index
number ?
Thanks
Daniel

  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 354
Default color bar with pattern macro

Thanks John
Why we have to create a sub FillPattern(). Does excel macro has the build
in function of fill pattern? I have a sub already and do not want to create
another sub.
in my sub may be I can write

IF
sales 10000
.Fill.Patterned Pattern:=msoPatternLightUpwardDiagonal

But there are no object for this, it will show error! How can I fix this?
Thanks
Daniel

"John Mansfield" wrote:

Assuming a simble bar chart with one series, try something like this . . .

Sub FillPatterns()
ActiveChart.SeriesCollection(1).Select
With Selection
.Fill.Visible = True
.Fill.Patterned Pattern:=msoPatternLightUpwardDiagonal
.Fill.ForeColor.SchemeColor = 15
.Fill.BackColor.SchemeColor = 4
End With
End Sub

You can change the pattern type, forecolor, and backcolor.

--
John Mansfield
http://cellmatrix.net





"Daniel" wrote:

Hi all
I know how to color excel bar with different colors using color index. How
can
I add pattern with the same color using macro. Do you know what index
number ?
Thanks
Daniel

  #4   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 235
Default color bar with pattern macro

Daniel,

This procedure will change the patterns based on a + / - 10,000 condition:

Sub ChangePatterns()

Dim Cht As Chart
Dim Srs As Series
Dim Pts As Points

Set Cht = ActiveChart
Set Srs = Cht.SeriesCollection(1)
Set Pts = Srs.Points

Cnt = 1

For Each Pt In Srs.Values

'Sales greater than 10000
If Pt 10000 Then

Srs.Points(Cnt).Select

With Selection
.Fill.Visible = True
.Fill.Patterned Pattern:=msoPatternWideUpwardDiagonal
.Fill.ForeColor.SchemeColor = 42
.Fill.BackColor.SchemeColor = 34
End With

'Sales less than or equal to 10000
ElseIf Pt <= 10000 Then

Srs.Points(Cnt).Select

With Selection
.Fill.Visible = True
.Fill.Patterned Pattern:=msoPatternLightHorizontal
.Fill.ForeColor.SchemeColor = 45
.Fill.BackColor.SchemeColor = 28
End With

End If

Cnt = Cnt + 1

Next Pt

ActiveChart.Deselect

End Sub

I may not be understanding what your wanting. Hopefully this helps.

--
John Mansfield
http://cellmatrix.net





"Daniel" wrote:

Thanks John
Why we have to create a sub FillPattern(). Does excel macro has the build
in function of fill pattern? I have a sub already and do not want to create
another sub.
in my sub may be I can write

IF
sales 10000
.Fill.Patterned Pattern:=msoPatternLightUpwardDiagonal

But there are no object for this, it will show error! How can I fix this?
Thanks
Daniel

"John Mansfield" wrote:

Assuming a simble bar chart with one series, try something like this . . .

Sub FillPatterns()
ActiveChart.SeriesCollection(1).Select
With Selection
.Fill.Visible = True
.Fill.Patterned Pattern:=msoPatternLightUpwardDiagonal
.Fill.ForeColor.SchemeColor = 15
.Fill.BackColor.SchemeColor = 4
End With
End Sub

You can change the pattern type, forecolor, and backcolor.

--
John Mansfield
http://cellmatrix.net





"Daniel" wrote:

Hi all
I know how to color excel bar with different colors using color index. How
can
I add pattern with the same color using macro. Do you know what index
number ?
Thanks
Daniel

  #5   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 354
Default color bar with pattern macro

Thnks John
You are an expert. Daniel

"John Mansfield" wrote:

Daniel,

This procedure will change the patterns based on a + / - 10,000 condition:

Sub ChangePatterns()

Dim Cht As Chart
Dim Srs As Series
Dim Pts As Points

Set Cht = ActiveChart
Set Srs = Cht.SeriesCollection(1)
Set Pts = Srs.Points

Cnt = 1

For Each Pt In Srs.Values

'Sales greater than 10000
If Pt 10000 Then

Srs.Points(Cnt).Select

With Selection
.Fill.Visible = True
.Fill.Patterned Pattern:=msoPatternWideUpwardDiagonal
.Fill.ForeColor.SchemeColor = 42
.Fill.BackColor.SchemeColor = 34
End With

'Sales less than or equal to 10000
ElseIf Pt <= 10000 Then

Srs.Points(Cnt).Select

With Selection
.Fill.Visible = True
.Fill.Patterned Pattern:=msoPatternLightHorizontal
.Fill.ForeColor.SchemeColor = 45
.Fill.BackColor.SchemeColor = 28
End With

End If

Cnt = Cnt + 1

Next Pt

ActiveChart.Deselect

End Sub

I may not be understanding what your wanting. Hopefully this helps.

--
John Mansfield
http://cellmatrix.net





"Daniel" wrote:

Thanks John
Why we have to create a sub FillPattern(). Does excel macro has the build
in function of fill pattern? I have a sub already and do not want to create
another sub.
in my sub may be I can write

IF
sales 10000
.Fill.Patterned Pattern:=msoPatternLightUpwardDiagonal

But there are no object for this, it will show error! How can I fix this?
Thanks
Daniel

"John Mansfield" wrote:

Assuming a simble bar chart with one series, try something like this . . .

Sub FillPatterns()
ActiveChart.SeriesCollection(1).Select
With Selection
.Fill.Visible = True
.Fill.Patterned Pattern:=msoPatternLightUpwardDiagonal
.Fill.ForeColor.SchemeColor = 15
.Fill.BackColor.SchemeColor = 4
End With
End Sub

You can change the pattern type, forecolor, and backcolor.

--
John Mansfield
http://cellmatrix.net





"Daniel" wrote:

Hi all
I know how to color excel bar with different colors using color index. How
can
I add pattern with the same color using macro. Do you know what index
number ?
Thanks
Daniel

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
cell pattern - color tikchye_oldLearner57 Excel Discussion (Misc queries) 2 April 11th 07 12:28 PM
Date sensitive cell pattern color Darrell Shuman Excel Worksheet Functions 4 August 17th 06 04:26 PM
How do you control the color/pattern of a pie chart? Pie chart Charts and Charting in Excel 1 July 15th 06 10:57 PM
Prefil Color Pattern in Excel David Excel Worksheet Functions 3 February 16th 06 09:44 PM
Pie Chart Color/Pattern cjc Charts and Charting in Excel 1 June 9th 05 04:07 AM


All times are GMT +1. The time now is 02:10 PM.

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"