Need some help I am a newbie to VBA

Spiffierlime

New Member
Joined
Mar 10, 2021
Messages
21
Office Version
  1. 365
Platform
  1. Windows
Need help solving my VBA Riddle please someone with the professional knowledge, Please

VBA

Private Sub CommandButton3_Click()

If Range("V1").Value = ("Complete") Then ' this code needs changing to look at a cell on another sheet i.e sheet 1 Range A1
ActiveSheet.Shapes("Oval 57").Fill.ForeColor.RGB = RGB(252, 74, 235)
Else
ActiveSheet.Shapes("Oval 57").Fill.ForeColor.RGB = RGB(255, 255, 255)

End If
'Need to loop this code to check Range V2 and fill Oval 58 and so on RangeV3, and fill oval 59, RangeV4 and fill Oval 60 untill the end
End Sub
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Where is the last cell to check in col V or can it vary?
 
Upvote 0
So you don't want to look at A1 as you said in your post?
 
Upvote 0
Ok, try
VBA Code:
Sub Spifferlime()
   Dim i As Long
   
   For i = 3 To 69
      If Range("V" & i).Value = Sheets("Sheet1").Range("A1").Value Then
         ActiveSheet.Shapes("Oval " & i + 54).Fill.ForeColor.RGB = RGB(252, 74, 255)
      Else
         ActiveSheet.Shapes("Oval " & i + 54).Fill.ForeColor.RGB = RGB(252, 255, 255)
      End If
   Next i
End Sub
 
Upvote 0
Ok, try
VBA Code:
Sub Spifferlime()
   Dim i As Long
  
   For i = 3 To 69
      If Range("V" & i).Value = Sheets("Sheet1").Range("A1").Value Then
         ActiveSheet.Shapes("Oval " & i + 54).Fill.ForeColor.RGB = RGB(252, 74, 255)
      Else
         ActiveSheet.Shapes("Oval " & i + 54).Fill.ForeColor.RGB = RGB(252, 255, 255)
      End If
   Next i
End Sub
not working for me, don't think i am explaining issue in enougth detail please be paitent with me.
 

Attachments

  • Sheet 8 data.PNG
    Sheet 8 data.PNG
    65.9 KB · Views: 13
  • Shhet 2 shapes.PNG
    Shhet 2 shapes.PNG
    46.3 KB · Views: 13
Upvote 0
As the user hits complete on each row there is a corrisponding shape on sheet 8 that needs to filled in, sorry
 
Upvote 0
Private Sub CommandButton3_Click()

Dim i As Long

For i = 3 To 69
If Range("V" & i).Value = Sheets("Sheet8").Range("D3").Value = ("Complete") Then
ActiveSheet.Shapes("Oval " & i + 54).Fill.ForeColor.RGB = RGB(252, 74, 255)
Else
ActiveSheet.Shapes("Oval " & i + 54).Fill.ForeColor.RGB = RGB(252, 255, 255)
End If
Next i
End Sub
 

Attachments

  • debug error.PNG
    debug error.PNG
    5.2 KB · Views: 7
  • Vba being used.PNG
    Vba being used.PNG
    17.3 KB · Views: 7
Upvote 0
That error means you don't have a sheet called "Sheet8"
 
Upvote 0

Forum statistics

Threads
1,214,648
Messages
6,120,725
Members
448,987
Latest member
marion_davis

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