add red oval shape into same row contain name based on inputbox user

Mussa

Active Member
Joined
Jul 12, 2021
Messages
264
Office Version
  1. 2019
  2. 2010
hi
today I got assistance from @DanteAmor about add oval shape to selected range from this thread
how add red oval shapes around the values based on selected range or separated cells
now I want doing that by input box user should search name based on column B and when find the name should add oval shape in the same row for each cell is relating of the name
see the pic 1 when write name input box and pic2 the result should be
i try adjusting the code , but not succeed so far .
VBA Code:
Sub AddRedOval()
  Dim shp As Shape
  Dim c As Range, r As Range
  Dim Value As Variant
  ActiveSheet.DrawingObjects.Delete
  Value = InputBox("Enter Value:", "Input")
Set r = Sheets(sheet1).Columns("B:B").Find(What:=Value, LookIn:=xlFormulas, _
    LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
    MatchCase:=True, SearchFormat:=False)
  'Set r = Selection
  For Each c In r
    If c.Value <> "" Then
      Set shp = ActiveSheet.Shapes.AddShape(msoShapeOval, c.Left, c.Top, c.Width, c.Height)
      shp.Fill.Transparency = 1
      shp.Line.ForeColor.RGB = RGB(255, 0, 0)
      shp.Line.Weight = 1
    End If
  Next
End Sub

2.PNG



3.PNG
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
What is happening when you run this? An error code? Not circling the correct cells?
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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