View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Duncan[_5_] Duncan[_5_] is offline
external usenet poster
 
Posts: 290
Default Range always being the right size

Hi all, this is bugging me!, I want to set a range in a formula that is
always only the cells with stuff in, I was going to put make named
ranges with a button but it doesnt want to play! any ideas?

Private Sub CommandButton2_Click()
Set Rng1a = Range("A2")
Set RnG1 = Range("A1").End(xlDown)
ActiveWorkbook.Names.Add Name:="ARNG", RefersTo:=Rng1a: Rng1
End Sub

The last line will not create the A range (ARNG), i just want a range
called ARNG that refers to a2 to the last cell with stuff in in column
A.

Im sure this should be easy!

(my formula in excel will then refer to ARNG)

Duncan