In VBA Excel, how can I restore individual cells?
In my VBA program, I fill individual cells with light green color using:
CIBE_Cell.Interior.Color = &HC0FFC0 and this works ok. When I want to restore the cells to white, I set: CIBE_Cell.Interior.Color = &HFFFFFF and the fill color is reset to white. But the borders of the cells are white and thus invisible. All the other cells in the spreadsheet have their normal default light blue borders. I tried to reset the borders in the program with CIBE_Cell.Borders.LineStyle = xlContinuous CIBE_Cell.Borders.Weight = xlHairline CIBE_Cell.Borders.Color = xlLightBlue but this makes the borders come out black and dotted - not light blue and continuous. I removed these 3 lines, and after running my program, the cells have the white borders again instead of the standard light blue ones that all the other cells have. After the program ends I can reset the borders by going to the Fill menu and selecting "No Fill". Notice this is NOT to the Borders menu & selecting "No Border", because the white "border" is not considered by Excel to be a border! How can I do this in my VBA program? I've tried to set the GridLineColor property, but that gives errors because it probably cannot be used to refer to single cells. |
In VBA Excel, how can I restore individual cells?
Instead of:
CIBE_Cell.Interior.Color = &HFFFFFF try: CIBE_Cell.Interior.Color = xlNone -- Gary''s Student - gsnu200740 "Richard" wrote: In my VBA program, I fill individual cells with light green color using: CIBE_Cell.Interior.Color = &HC0FFC0 and this works ok. When I want to restore the cells to white, I set: CIBE_Cell.Interior.Color = &HFFFFFF and the fill color is reset to white. But the borders of the cells are white and thus invisible. All the other cells in the spreadsheet have their normal default light blue borders. I tried to reset the borders in the program with CIBE_Cell.Borders.LineStyle = xlContinuous CIBE_Cell.Borders.Weight = xlHairline CIBE_Cell.Borders.Color = xlLightBlue but this makes the borders come out black and dotted - not light blue and continuous. I removed these 3 lines, and after running my program, the cells have the white borders again instead of the standard light blue ones that all the other cells have. After the program ends I can reset the borders by going to the Fill menu and selecting "No Fill". Notice this is NOT to the Borders menu & selecting "No Border", because the white "border" is not considered by Excel to be a border! How can I do this in my VBA program? I've tried to set the GridLineColor property, but that gives errors because it probably cannot be used to refer to single cells. |
In VBA Excel, how can I restore individual cells?
Thanks! That works!
"Gary''s Student" wrote: Instead of: CIBE_Cell.Interior.Color = &HFFFFFF try: CIBE_Cell.Interior.Color = xlNone -- Gary''s Student - gsnu200740 "Richard" wrote: In my VBA program, I fill individual cells with light green color using: CIBE_Cell.Interior.Color = &HC0FFC0 and this works ok. When I want to restore the cells to white, I set: CIBE_Cell.Interior.Color = &HFFFFFF and the fill color is reset to white. But the borders of the cells are white and thus invisible. All the other cells in the spreadsheet have their normal default light blue borders. I tried to reset the borders in the program with CIBE_Cell.Borders.LineStyle = xlContinuous CIBE_Cell.Borders.Weight = xlHairline CIBE_Cell.Borders.Color = xlLightBlue but this makes the borders come out black and dotted - not light blue and continuous. I removed these 3 lines, and after running my program, the cells have the white borders again instead of the standard light blue ones that all the other cells have. After the program ends I can reset the borders by going to the Fill menu and selecting "No Fill". Notice this is NOT to the Borders menu & selecting "No Border", because the white "border" is not considered by Excel to be a border! How can I do this in my VBA program? I've tried to set the GridLineColor property, but that gives errors because it probably cannot be used to refer to single cells. |
All times are GMT +1. The time now is 03:33 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com