Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Locking individual cells in an excel spreadsheet | Excel Worksheet Functions | |||
Locing individual cells In Excel Sheet from vb.net | Excel Worksheet Functions | |||
Excel: Remove color background from cells, restore grid. | Excel Discussion (Misc queries) | |||
How do I protect individual cells in Excel and not whole sheet? | Excel Discussion (Misc queries) | |||
You should be able to lock individual Excel cells | Excel Worksheet Functions |