Hi all,
As noted on earlier post this week, I'm just starting out with VBA. When I used the recorder to remove all border lines it spits this code below. Seems really long? I want to learn the smartest/most concise code I can from the get go so I don't start with bad habits.
Range("I7:N26").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
I tried using the "With" approach a few different ways to shorten it (adding With/End With and removing all instances of "Selection"), but not sure what the rules/order are... I'm keep getting an error msg that I need an object or something similar.
Any help would be appreciated.
Thanks,
James
As noted on earlier post this week, I'm just starting out with VBA. When I used the recorder to remove all border lines it spits this code below. Seems really long? I want to learn the smartest/most concise code I can from the get go so I don't start with bad habits.
Range("I7:N26").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
I tried using the "With" approach a few different ways to shorten it (adding With/End With and removing all instances of "Selection"), but not sure what the rules/order are... I'm keep getting an error msg that I need an object or something similar.
Any help would be appreciated.
Thanks,
James