Wednesday, 6 July 2016

Automate drawing a circle around cell [Anwsered]

Automate drawing a circle around cell

I need help with Excel programming macro code to draw a circle around the cell if a cell equal 3.
Is it possible? Thanks

Anwsers to the Problem Automate drawing a circle around cell

Download Error Fixer for Free Now

Oh, I also forgot to mention, the column on each cell is 7.57 (58 pixels) and each row is 15.75 (21 pixels) times 2x.
So the circle should cover within column 7.57 x 31.5 (15.75 x2).

The row/column dimensions are immaterial as my code obtains them directly from Excel and adjusts the circles to whatever size they happen to be.
Here is my code, modified to processALL worksheets and which allows you to resize the circles by
changing a single value...
the Factor variable in the second line of code.
Using a value of Sqr(2), which is approximately 1.414, forces the oval to touch all four corners of the cells it is encircling...
using a value of 1.0 will make the oval small enough
to fit inside the cell just touching each side of the rectangle enclosing the two cells. Set the value somewhere between 1 and 1.414 will probably get you an oval you like.
Try a value of 1.1 (I preset the code for that value) as that kind of looked okay to
me (touches the values in the cells without obliterating them...
if your values are centered aligned within the cells, then this setting for the Factor variable would be perfect I think).
Let me know if this does what you want...
Sub CircleStatusCells()
  Dim X As Long, Z As Long, LastRow As Long, LastColumn As Long, My_Circle As Shape, WS As Worksheet, Factor As Double
  Factor = 1.1
  For Each WS In Worksheets
    LastRow = WS.Cells.Find(What:="*", SearchOrder:=xlRows, _
              SearchDirection:=xlPrevious, LookIn:=xlFormulas).Row
    LastColumn = WS.Cells.Find(What:="*", SearchOrder:=xlByColumns, _
                 SearchDirection:=xlPrevious, LookIn:=xlFormulas).Column
    For Each My_Circle In WS.Shapes
      If My_Circle.Name Like "CircleNumber3At_*" Then My_Circle.Delete
    For X = 14 To LastRow Step 3
      For Z = 5 To LastColumn
        If WS.Cells(X, Z).Value = 3 Then
          With WS.Cells(X, Z)
            Set My_Circle = WS.Shapes.AddShape(msoShapeOval, .Left - (Factor - 1) * _
                            .Width / 2, .Offset(-1).top - (Factor - 1) * (.Offset(-1).Height + _
                            .Offset(1).Height) / 2, Factor * .Width, Factor * _
                            (.Offset(-1).Height + .Offset(1).Height))
            My_Circle.Name = "CircleNumber3At_" & .Address(False, False)
          End With
          My_Circle.Fill.Visible = msoFalse
          My_Circle.Line.ForeColor.RGB = RGB(255, 0, 0)
        End If
End Sub

Check Windows System Requirements

You need to double-check your computer's hardware configuration against the following Microsoft requirements. If your PC hardware is not up to par, then make sure you update where necessary before continuing:

Microsoft Windows Requirements :

  • 1 gigahertz (GHz) or faster 32-bit (x86) or 64-bit (x64) processor
  • 1 gigabyte (GB) RAM (32-bit) or 2 GB RAM (64-bit)
  • 16 GB available hard disk space (32-bit) or 20 GB (64-bit)

If your computer meets the minimum requirements above, then continue on…

Recommended Method to Repair the Problem: Automate drawing a circle around cell:

How to Fix Automate drawing a circle around cell with SmartPCFixer?

1. Click the button to download Error Fixer . Install it on your system.  Open it, and it will perform a scan for your system. The errors will be shown in the list.

2. After the scan is done, you can see the errors and problems which need to be fixed.

3. The Fixing part is done, the speed of your computer will be much higher than before and the errors have been fixed.

Related: AMD Radeon HD 7800M Win8 not working [Anwsered],I can access the internet, get on facebook and get to hotmail, but I can't play games on facebook and I can't open or respond to my e-mails,I keep getting this Media Player error when I log on my computer. [Anwsered],[Anwsered] System Hanging on shutdown and restart,Unable to get the Vlookup property of the WorksheetFunction class,Solution to Error: Error: "0x81000032 make sure the C: drive is online and set to NTFS" when trying to backup to external hard drive.
,Troubleshoot:External Hard Drive not listed in Windows 7 backup wizard Error
,I'm always being signed off so annoying Tech Support
,Solution to Problem: Impossible to use Internet Explorer! I keep getting the same error message every time i try to use IE.
,Solution to Problem: Referencing data in another file
,Troubleshoot:Error: "0x81000032 make sure the C: drive is online and set to NTFS" when trying to backup to external hard drive. Error,External Hard Drive not listed in Windows 7 backup wizard Tech Support,Tech Support: I'm always being signed off so annoying,Solution to Problem: Impossible to use Internet Explorer! I keep getting the same error message every time i try to use IE.,Referencing data in Access using Excel [Anwsered],Need Best Way To Present Data [Anwsered],Same question but for windows 7 home edition,sometimes fullscreen won't activate [Solved],Solution to Error: We bought a new computer with windows 7 and it is constantly freezing. How do we fix this?,Solution to Error: Windows 8 update crash (2013-07-22)
Read More: Auto double click Tech Support,back up and restrore page for vista fails to load [Anwsered],Tech Support: Back up and restore not working,How Can You Fix - Automatically signing in to MSN??,[Solved] attach freecell icon to taskbar,application not found error,any problems in a team where one has Windows XP and the other has Windows 7?,Application/Object-Defined Error,An Excel formula question where hours are totalled and cumulating,Anyone know the hardware email?

No comments:

Post a comment