Once a time I was trying to create a report on excel through MS ACCESS vba. At that time I was really wanted to keep the border for all filled cells. I got a user define function from a browsing web page and it was really helpful. You can modify this function according to your requirement.
Execution Process :
Call this function inside your button just like a - call TheBorderLine or just put TheBorderLine.
Make sure that your workbook is open while calling this function.
Sub TheBorderLine()With ActiveSheet.UsedRange.Borders.LineStyle =xlContinuous.Weight = xlThin.ColorIndex = xlAutomaticEnd WithWith ActiveSheet.Cells.Font.Size ="10"ActiveSheet.Cells.HorizontalAlignment = xlLeftEnd WithRange("A1:S1").SelectWith Selection.HorizontalAlignment = xlCenter.VerticalAlignment = xlCenterEnd WithEnd Sub
Call this function inside your button just like a - call TheBorderLine or just put TheBorderLine.
Make sure that your workbook is open while calling this function.
No comments:
Post a Comment