Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm in need of help. I have an Excel sheet that has some rectangle shapes.
I want to add some command buttons to change the color of these rectangles, but I only want those shapes I select to be changed. Here is a "Reset" command button code I use to turn all my shapes Red: Private Sub CommandButton1_Click() ActiveSheet.Shapes.SelectAll Selection.ShapeRange.Fill.ForeColor.SchemeColor = 10 Selection.ShapeRange.Fill.Visible = msoTrue Selection.ShapeRange.Fill.Solid Range("A1").Select End Sub Now I know how to change a single shape that I specify: ActiveSheet.Shapes("Rectangle 1").Select But how do I change only the ones I currently have selected? And is there a better way to unselect (deselect) rather than using Range("A1").Select? Thanks in advance, Scott |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I get a runtime error "438". Here is how I have it:
Private Sub CommandButton2_Click() With Selection .ShapeRange.Fill.ForeColor.SchemeColor = 12 End With Range("A1").Select End Sub The runtime error '438' "Object doesn't support this property or method". The debugger highlights the line ".shaperange.fill.forecolor.....". "Don Guillett" wrote in message ... try with selection .ShapeRange.Fill.ForeColor.SchemeColor = 10 end with -- Don Guillett SalesAid Software "Nimrod" wrote in message ... I'm in need of help. I have an Excel sheet that has some rectangle shapes. I want to add some command buttons to change the color of these rectangles, but I only want those shapes I select to be changed. Here is a "Reset" command button code I use to turn all my shapes Red: Private Sub CommandButton1_Click() ActiveSheet.Shapes.SelectAll Selection.ShapeRange.Fill.ForeColor.SchemeColor = 10 Selection.ShapeRange.Fill.Visible = msoTrue Selection.ShapeRange.Fill.Solid Range("A1").Select End Sub Now I know how to change a single shape that I specify: ActiveSheet.Shapes("Rectangle 1").Select But how do I change only the ones I currently have selected? And is there a better way to unselect (deselect) rather than using Range("A1").Select? Thanks in advance, Scott |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Did you select the shapes first?
-- Don Guillett SalesAid Software "Nimrod" wrote in message ... I get a runtime error "438". Here is how I have it: Private Sub CommandButton2_Click() With Selection .ShapeRange.Fill.ForeColor.SchemeColor = 12 End With Range("A1").Select End Sub The runtime error '438' "Object doesn't support this property or method". The debugger highlights the line ".shaperange.fill.forecolor.....". "Don Guillett" wrote in message ... try with selection .ShapeRange.Fill.ForeColor.SchemeColor = 10 end with -- Don Guillett SalesAid Software "Nimrod" wrote in message ... I'm in need of help. I have an Excel sheet that has some rectangle shapes. I want to add some command buttons to change the color of these rectangles, but I only want those shapes I select to be changed. Here is a "Reset" command button code I use to turn all my shapes Red: Private Sub CommandButton1_Click() ActiveSheet.Shapes.SelectAll Selection.ShapeRange.Fill.ForeColor.SchemeColor = 10 Selection.ShapeRange.Fill.Visible = msoTrue Selection.ShapeRange.Fill.Solid Range("A1").Select End Sub Now I know how to change a single shape that I specify: ActiveSheet.Shapes("Rectangle 1").Select But how do I change only the ones I currently have selected? And is there a better way to unselect (deselect) rather than using Range("A1").Select? Thanks in advance, Scott |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yes sir. I have two shapes (both rectangles) and I tried to select either
as well as both, and I get the same error. Any other ideas? Thanks again for your assistance! Scott "Don Guillett" wrote in message ... Did you select the shapes first? -- Don Guillett SalesAid Software "Nimrod" wrote in message ... I get a runtime error "438". Here is how I have it: Private Sub CommandButton2_Click() With Selection .ShapeRange.Fill.ForeColor.SchemeColor = 12 End With Range("A1").Select End Sub The runtime error '438' "Object doesn't support this property or method". The debugger highlights the line ".shaperange.fill.forecolor.....". "Don Guillett" wrote in message ... try with selection .ShapeRange.Fill.ForeColor.SchemeColor = 10 end with -- Don Guillett SalesAid Software "Nimrod" wrote in message ... I'm in need of help. I have an Excel sheet that has some rectangle shapes. I want to add some command buttons to change the color of these rectangles, but I only want those shapes I select to be changed. Here is a "Reset" command button code I use to turn all my shapes Red: Private Sub CommandButton1_Click() ActiveSheet.Shapes.SelectAll Selection.ShapeRange.Fill.ForeColor.SchemeColor = 10 Selection.ShapeRange.Fill.Visible = msoTrue Selection.ShapeRange.Fill.Solid Range("A1").Select End Sub Now I know how to change a single shape that I specify: ActiveSheet.Shapes("Rectangle 1").Select But how do I change only the ones I currently have selected? And is there a better way to unselect (deselect) rather than using Range("A1").Select? Thanks in advance, Scott |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Change the takefocusonclick property of your commandbutton to false.
Then it should work. -- Regards, Tom Ogilvy "Nimrod" wrote in message ... Yes sir. I have two shapes (both rectangles) and I tried to select either as well as both, and I get the same error. Any other ideas? Thanks again for your assistance! Scott "Don Guillett" wrote in message ... Did you select the shapes first? -- Don Guillett SalesAid Software "Nimrod" wrote in message ... I get a runtime error "438". Here is how I have it: Private Sub CommandButton2_Click() With Selection .ShapeRange.Fill.ForeColor.SchemeColor = 12 End With Range("A1").Select End Sub The runtime error '438' "Object doesn't support this property or method". The debugger highlights the line ".shaperange.fill.forecolor.....". "Don Guillett" wrote in message ... try with selection .ShapeRange.Fill.ForeColor.SchemeColor = 10 end with -- Don Guillett SalesAid Software "Nimrod" wrote in message ... I'm in need of help. I have an Excel sheet that has some rectangle shapes. I want to add some command buttons to change the color of these rectangles, but I only want those shapes I select to be changed. Here is a "Reset" command button code I use to turn all my shapes Red: Private Sub CommandButton1_Click() ActiveSheet.Shapes.SelectAll Selection.ShapeRange.Fill.ForeColor.SchemeColor = 10 Selection.ShapeRange.Fill.Visible = msoTrue Selection.ShapeRange.Fill.Solid Range("A1").Select End Sub Now I know how to change a single shape that I specify: ActiveSheet.Shapes("Rectangle 1").Select But how do I change only the ones I currently have selected? And is there a better way to unselect (deselect) rather than using Range("A1").Select? Thanks in advance, Scott |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Calculate quantity of shapes inside another shape | Excel Discussion (Misc queries) | |||
Changing color of selected cells in Excel 2007 | Excel Discussion (Misc queries) | |||
Changing default color of selected cells in 2007 | Excel Discussion (Misc queries) | |||
Changing the color of a selected range | Excel Discussion (Misc queries) | |||
Deleting shapes/objects from a selected area | Excel Programming |