Deselect Freeform after Macro has ran (VBA)

Deladier

Board Regular
Joined
May 4, 2005
Messages
131
Office Version
  1. 365
Platform
  1. Windows
Hello.
Using a ComboBox, per example, I could call either Macro6 or Macro7 in order to change color of my Freeform object, but after Macro6 or Macro7 has ran, Freeform remains selected.
I could select any cell to deselect Freeform, or using ESC code, but anyway that's not what I want, the idea is not to leave ComboBox.

Or an alternative to the problem:

Is there some way in Macro6 and Macro7 of not selecting Freeform from the begining, just directly to change the color of the Freeform, avoiding that Freeform being selected at last?


Macro6 and Macro7 code description:

Sub Macro6()
ActiveSheet.Shapes.Range(Array("Freeform 161")).Select 'Yellow color
With Selection.ShapeRange.Line
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 192, 0)
.Transparency = 0
End With
End Sub

Sub Macro7()
ActiveSheet.Shapes.Range(Array("Freeform 161")).Select 'Brown color
With Selection.ShapeRange.Line
.Visible = msoTrue
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = -0.5
.Transparency = 0
End With
End Sub
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Try the following...

VBA Code:
Sub Macro6()
    With ActiveSheet.Shapes("Freeform 161").Line
        .Visible = msoTrue
        .ForeColor.RGB = RGB(255, 192, 0)
        .Transparency = 0
    End With
End Sub

Sub Macro7()
    With ActiveSheet.Shapes("Freeform 161").Line
        .Visible = msoTrue
        .ForeColor.TintAndShade = 0
        .ForeColor.Brightness = -0.5
        .Transparency = 0
    End With
End Sub

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,224,815
Messages
6,181,135
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top