View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ryan H Ryan H is offline
external usenet poster
 
Posts: 489
Default Set Range with Long Variable

I have 3 ranges I want to add vertical lines too, but I keep getting an error
that says "Wrong Number of Arguements or Invalid Property Assignment."
Anyone know why? Is there a cleaner way to write out this range?

Sub AddLines()

Dim lngFirstRow As Long
Dim lngLastRow As Long

' adds thin vertical lines to separate columns
With Range("B" & lngFirstRow & ":B" & lngLastRow, _
"F" & lngFirstRow & ":F" & lngLastRow, _
"H" & lngFirstRow & ":H" & lngLastRow)
.Borders(xlEdgeLeft).Weight = xlThin
.Borders(xlEdgeRight).Weight = xlThin
End With

End Sub
--
Cheers,
Ryan