ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Please help with code (https://www.excelbanter.com/excel-programming/316895-please-help-code.html)

Paul

Please help with code
 
Does anybody know how to loop the following code:
I need to increase the shape number by 1 each loop and
the case range has to drop down one cell for each loop.
thank you inmensly to the person that can answer this.
calpino

Private Sub Worksheet_Change(ByVal Target As Range)
Dim shp As Shape

Set shp = ActiveSheet.Shapes("1001")
Select Case Range("a1").Value
Case Is = 0
shp.Fill.ForeColor.SchemeColor = 9
Case Is = 450
shp.Fill.ForeColor.SchemeColor = 10
Case Is = 50
shp.Fill.ForeColor.SchemeColor = 13
Case Else
shp.Fill.ForeColor.SchemeColor = 50
End Select

Tom Ogilvy

Please help with code
 
for i = 1 to 10
Set shp = ActiveSheet.Shapes(format(1000 + i,"0000"))
Select Case Range("a1").offset(i-1,0).Value
Case Is = 0
shp.Fill.ForeColor.SchemeColor = 9
Case Is = 450
shp.Fill.ForeColor.SchemeColor = 10
Case Is = 50
shp.Fill.ForeColor.SchemeColor = 13
Case Else
shp.Fill.ForeColor.SchemeColor = 50
End Select
Next


--
Regards,
Tom Ogilvy


"Paul" wrote in message
m...
Does anybody know how to loop the following code:
I need to increase the shape number by 1 each loop and
the case range has to drop down one cell for each loop.
thank you inmensly to the person that can answer this.
calpino

Private Sub Worksheet_Change(ByVal Target As Range)
Dim shp As Shape

Set shp = ActiveSheet.Shapes("1001")
Select Case Range("a1").Value
Case Is = 0
shp.Fill.ForeColor.SchemeColor = 9
Case Is = 450
shp.Fill.ForeColor.SchemeColor = 10
Case Is = 50
shp.Fill.ForeColor.SchemeColor = 13
Case Else
shp.Fill.ForeColor.SchemeColor = 50
End Select





All times are GMT +1. The time now is 09:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com