![]() |
vba repeat in the next cell down
I am trying to create a refresh macro that turn a number of cells back to
green. I no i can do it at a an individual cell (i have pasted the code i have used) level is there an easier less time consuming way as i have quite a few cells i need to do this for. Range("B2").Select ActiveCell.FormulaR1C1 = "Green" |
vba repeat in the next cell down
Range("B2,c3:c99,d1,e1,f3:f8").value = "Green"
Gets a lot of cells at once. Jelinek wrote: I am trying to create a refresh macro that turn a number of cells back to green. I no i can do it at a an individual cell (i have pasted the code i have used) level is there an easier less time consuming way as i have quite a few cells i need to do this for. Range("B2").Select ActiveCell.FormulaR1C1 = "Green" -- Dave Peterson |
vba repeat in the next cell down
Jelinek,
Try Sub ColourSelection() Dim TargetCell As Object For Each TargetCell In Selection Selection.Interior.ColorIndex = 38 Next End Sub You can select multiple cells/ranges on a worksheet by holding down the Control key whilst you click and select them. Then run the macro - all the selected cells will (in this case) turn light pink. Try changing the number to change the colour or use Selection.Interior.ColorIndex = 38 to remove colour completely. Here's a list of colours and their corresponding values. Those with a D after them indicate duplicates - i.e. colours that can be generated by more than one number. Black 1 White 2 Red 3 Bright Green 4 Blue 5 Yellow 6 Pink 7 Turquoise 8 Dark Red 9 Green 10 Dark Blue 11 Dark Yellow 12 Violet 13 Teal 14 Gray-25% 15 Gray 50% 16 Periwinkle 17 Plum (D54) 18 Ivory 19 Light Turquoise (D34) 20 Dark Purple 21 Coral 22 Ocean Blue 23 Ice Blue 24 Dark Blue (D11) 25 Pink (D7) 26 Yellow (D6) 27 Turquoise (D8) 28 Violet (D13) 29 Dark Red (D9) 30 Teal (D14) 31 Blue (D5) 32 Sky Blue 33 Light Turquoise 34 Light Green 35 Light Yellow 36 Pale Blue 37 Rose 38 Tan 40 Light Blue 41 Aqua 42 Lime 43 Gold 44 Light Orange 45 Orange 46 Blue-Gray 47 Gray-40% 48 Dark Teal 49 Lavender 49 Sea Green 50 Dark Green 51 Olive Green 52 Brown 53 Plum 54 Indigo 55 Gray 80% 56 Hope this helps Regards Pete "Jelinek" wrote: I am trying to create a refresh macro that turn a number of cells back to green. I no i can do it at a an individual cell (i have pasted the code i have used) level is there an easier less time consuming way as i have quite a few cells i need to do this for. Range("B2").Select ActiveCell.FormulaR1C1 = "Green" |
All times are GMT +1. The time now is 11:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com