View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Range naming cells with blank cells through coding

The following will create a Named range of the empty cells below A5 until a
non-empty cell is found:

Sub servient()
Set a5 = Range("A5")
s = "=Sheet1!$A$6:$A$" & a5.End(xlDown).Row - 1
ActiveWorkbook.Names.Add Name:="bigji", RefersTo:=s
End Sub

--
Gary''s Student - gsnu200776


"Naveen J V" wrote:

Hi,

Through macro, how do I name a range which consists of blank cells in
between. The range will be derived dynamically, where only the starting cell
is known. For example, Range starts frm A5, and end cell should be selected
dynamically based on the data. In between the dynamic range there may be some
blank cells. How to I code?

Thanks in advance