kcimos Posted September 14, 2012 Posted September 14, 2012 can anyone tell me why this code results in a style that only has the left edge set to xlhairline & the others are set to nothing? & when I edit the style in XL, it says that the border is set to left. GrayStyle = wbWorkbook.Styles.Add("gray") GrayStyle.Interior.Pattern = Excel.XlPattern.xlPatternSolid GrayStyle.Interior.PatternColorIndex = Excel.XlColorIndex.xlColorIndexAutomatic GrayStyle.Interior.ThemeColor = Excel.XlThemeColor.xlThemeColorDark2 GrayStyle.Interior.TintAndShade = -0.0999786370433668 GrayStyle.Interior.PatternTintAndShade = 0 GrayStyle.Borders(Excel.XlBordersIndex.xlInsideVertical).LineStyle = Excel.XlBorderWeight.xlHairline GrayStyle.Borders(Excel.XlBordersIndex.xlInsideVertical).LineStyle = Excel.XlLineStyle.xlContinuous GrayStyle.Borders(Excel.XlBordersIndex.xlInsideHorizontal).LineStyle = Excel.XlBorderWeight.xlHairline GrayStyle.Borders(Excel.XlBordersIndex.xlInsideHorizontal).LineStyle = Excel.XlLineStyle.xlContinuous GrayStyle.Borders(Excel.XlBordersIndex.xlEdgeLeft).LineStyle = Excel.XlBorderWeight.xlHairline GrayStyle.Borders(Excel.XlBordersIndex.xlEdgeLeft).LineStyle = Excel.XlLineStyle.xlContinuous GrayStyle.Borders(Excel.XlBordersIndex.xlEdgeRight).LineStyle = Excel.XlBorderWeight.xlHairline GrayStyle.Borders(Excel.XlBordersIndex.xlEdgeRight).LineStyle = Excel.XlLineStyle.xlContinuous GrayStyle.Borders(Excel.XlBordersIndex.xlEdgeTop).LineStyle = Excel.XlBorderWeight.xlHairline GrayStyle.Borders(Excel.XlBordersIndex.xlEdgeTop).LineStyle = Excel.XlLineStyle.xlContinuous GrayStyle.Borders(Excel.XlBordersIndex.xlEdgeBottom).LineStyle = Excel.XlBorderWeight.xlHairline GrayStyle.Borders(Excel.XlBordersIndex.xlEdgeBottom).LineStyle = Excel.XlLineStyle.xlContinuous All I really want to do is change the color of some cells without changing the other cell formatting, but I couldn't find any info on doing that, so it seems that I need to create a style for every type of formatting combination I need. Quote
Recommended Posts