View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rowan Drummond[_3_] Rowan Drummond[_3_] is offline
external usenet poster
 
Posts: 414
Default Newbie Q: Range from two cells

Hi Garry

If you refer to a range using the A1 notation then you would use a
string to define the address of that range e.g.
Range("A1").font.bold = true
So the methods I used to accomplish your requirements were the most
intuitive way to do this for me. There are other ways of doing it e.g.

Sub test3()
Dim CellA As Range
Dim CellB As Range
Dim myRange As Range

Set CellA = Range("A10")
Set CellB = Range("A20")

Set myRange = CellA.Resize(CellB.Row - CellA.Row + 1, 1)
Debug.Print myRange.Address

End Sub

More on working with ranges at:
http://j-walk.com/ss/excel/tips/tip20.htm

Regards
Rowan

Garry wrote:
Thanks for that Rowan. I'm a bit surprised that one converts things to
a string then back to a range. Is this a common technique in Excel?

Again, thanks for your response,
Garry