Thread: Select Range
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Select Range

Dim PrtRng As Range
Dim X As Double
Let X = 65
Set PrtRng = Range(Cells(11, 1), Cells(X, 7))
With PrtRng
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
End With


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Mike H." wrote in message
...
In my code I determine a range that I wish to select. What is the proper
syntax to select that range. Let's say I wish to add a line to all cells
selected. This does not work:
My hope would be to have every cell from 11,1 to 65,7 selected but I get
an
error on the line Range(PrtRng).select. Ideas?

Dim PrtRng as Range
Dim X as Double
let X=65
Set PrtRng = Range(Cells(11, 1), Cells(X, 7))
Range(PrtRng).Select
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With