Camera Tool Unwanted Copying

Justinian

Well-known Member
Joined
Aug 9, 2009
Messages
1,557
Office Version
  1. 365
Platform
  1. Windows
I am creating a dashboard that requires the camera tool. The reason is because I have custom formatting (red if negative number and green if positive) and I cannot use custom formatting on shapes, which is what my dashboard consists of. Each section of my dashboard is a square and one each square, I have a donut chart showing work order created vs completed. In the middle of that chart, I want to display the difference between created and completed but I cannot use a shape with custom formatting so I am using the camera tool. The problem is when I open the workbook or make changes, sometimes the camera image copies on top of itself.

Any idea why this happens or how I can stop it?
 
No to all of those.

Maybe an easier question would be how do I wrote code for the text box that says if the number is negative, make it red and if it is positive, make it green?
 
Upvote 0

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
What kind of controls are you working with, in your worksheet : Forms controls or ActiveX controls ?
 
Upvote 0
You could test following macro to be stored in the respective Sheet module :
VBA Code:
Private Sub TextBox1_Change()
   If Left(TextBox1.Text, 1) = "-" Then
      TextBox1.BackColor = vbRed
   Else
      TextBox1.BackColor = vbGreen
   End If
End Sub
 
Upvote 0
I tried that but the color portion is not working:
Book1
BCDEFGHIJ
6
7
8+23
9
10
11
12
13
14
15
Sheet1
 
Upvote 0
1680729699294.png
 
Upvote 0
I found this code but it keeps the font green regardless of negtive value:

Sub Color_Text_InBox()
ActiveSheet.Shapes.Range(Array("TextBox 1")).Select

If Range("a1").Value < 0 Then
'<0 is better
With Selection.ShapeRange.TextFrame2.TextRange.Font.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 176, 80)
.Transparency = 0
.Solid
End With
Selection.ShapeRange.TextFrame2.TextRange.Font.Bold = msoTrue
Else
'color the text box to show "not better"
With Selection.ShapeRange.TextFrame2.TextRange.Font.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(255, 0, 0)
.Transparency = 0
.Solid
End With
Selection.ShapeRange.TextFrame2.TextRange.Font.Bold = msoTrue
End If

End Sub
 
Upvote 0
Hi again,

I know it might sound confusing ....

If I understanding correctly ...
1. You are not using any Control Object from Developper>Insert to select either an ActiveX or a Forms TextBox
2. But you are using a Shape textbox ... what you are calling regular

These very different objects have very different characteristics and features, and offer a lot more OR a lot less in terms of flexibility.

As a matter of fact, based on what your actual final intent is, you should pick the appropriate Object, fully adapted to your specific situation

Hope this clarifies
 
Upvote 0
Yes, I am going to insert > text box. The codce I posted above works but it does not change the font color to red when the number is negative.

What kind of text box should I use with your code?
 
Upvote 0
To have the maximum flexibility, would recommend the ActiveX TextBox ...
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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