View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Revenue Revenue is offline
external usenet poster
 
Posts: 23
Default Macro needs updated Range name addresses

The range name "Current" needs to be a moving target so that when
something gets added at the bottom, the range updates itself. I tried
dynamic ranges with =offset and that did not pan out. This range is
used so that we can filter out rows with zeros in a certain column,
which is what the range "criteria" is for. The problem with this macro
right now is that I cannot properly assign the variable range1 to the
range name "Current" given that this range name does exist, it just
needs to be updated.

I have experimented with quite a few commands but right now look on
the 6th line down starting with
ActiveWorkbook.Names.Add Name:="Current" = Selection

Obviously that statement doesn't work or I would not be here typing
this right now.

Sub HideZeros()
Dim range1 As range
Application.Goto Reference:=range("start").Offset(1, 0)


Set range1 = range(ActiveCell.End(xlDown), ActiveCell.Offset(0, 25))
Application.Goto Reference:=range1

ActiveWorkbook.Names.Add Name:="Current" = Selection

range("Current").AdvancedFilter Action = xlFilterInPlace, _
CriteriaRange:=range("Criteria"), _
Unique:=False


End Sub