#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
rml rml is offline
external usenet poster
 
Posts: 50
Default Dynamic name

Gary's student had given me a very simple yet productive reply to my previous
post DEFINE NAME. Now I need to expand this answer to a little more
dynamic....Based from my previous post, I need to have an automatic
generation of a list of all the reference cells in blank "Group_1", lets say
in Column IV. wherein each cell here will contain the cell reference (e.g.
A2, J4). Hope Gary's will reply...thanks...
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Dynamic name

In the last post we created the "GROUP_1" named range.

After the range has been created, add the line:

MsgBox (Range("GROUP_1").Address)

This lists the cells that comprise GROUP_1
--
Gary's Student


"rml" wrote:

Gary's student had given me a very simple yet productive reply to my previous
post DEFINE NAME. Now I need to expand this answer to a little more
dynamic....Based from my previous post, I need to have an automatic
generation of a list of all the reference cells in blank "Group_1", lets say
in Column IV. wherein each cell here will contain the cell reference (e.g.
A2, J4). Hope Gary's will reply...thanks...

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
rml rml is offline
external usenet poster
 
Posts: 50
Default Dynamic name

Gary..this is the module....
________
Sub main()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 0 Then
For i = 1 To c
If .Names(i).Name = "GROUP_1" Then
..Names("GROUP_1").Delete
Exit For
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
s = rr.Address(ReferenceStyle:=xlR1C1)
MsgBox (s)
..Names.Add Name:="GROUP_1", RefersToR1C1:="=DYNANAME!" & s
End With
End Sub
_____

I dont know on which part i can insert the line.....
MsgBox (Range("GROUP_1").Address)
I hope also that we can generate cell refs. as requested by this thread..
thanks a lot

"Gary''s Student" wrote:

In the last post we created the "GROUP_1" named range.

After the range has been created, add the line:

MsgBox (Range("GROUP_1").Address)

This lists the cells that comprise GROUP_1
--
Gary's Student


"rml" wrote:

Gary's student had given me a very simple yet productive reply to my previous
post DEFINE NAME. Now I need to expand this answer to a little more
dynamic....Based from my previous post, I need to have an automatic
generation of a list of all the reference cells in blank "Group_1", lets say
in Column IV. wherein each cell here will contain the cell reference (e.g.
A2, J4). Hope Gary's will reply...thanks...

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Dynamic name

Hi:

Put this in the module. It also addresses the GROUP_2 issue:

Sub listum()
With ActiveWorkbook
If .Names.Count 0 Then
For i = 1 To .Names.Count
MsgBox (i & " " & .Names(i).Name & " " & Range(.Names(i)).Address)
Next
End If
End With
End Sub

Sub main2()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 1 Then
For i = c To 1 Step -1
If .Names(i).Name = "GROUP_1" Then
.Names("GROUP_1").Delete
End If
If .Names(i).Name = "GROUP_2" Then
.Names("GROUP_2").Delete
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_1", RefersToR1C1:="=Sheet1!" & s
End If

Set rr = Nothing
For Each r In Range("GROUP1")
If Not IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_2", RefersToR1C1:="=Sheet1!" & s
End If

Call listum

End With
End Sub


listum() handles the messaging. The routine will also work if you have no
blanks or all blanks.
--
Gary''s Student


"rml" wrote:

Gary..this is the module....
________
Sub main()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 0 Then
For i = 1 To c
If .Names(i).Name = "GROUP_1" Then
.Names("GROUP_1").Delete
Exit For
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
s = rr.Address(ReferenceStyle:=xlR1C1)
MsgBox (s)
.Names.Add Name:="GROUP_1", RefersToR1C1:="=DYNANAME!" & s
End With
End Sub
_____

I dont know on which part i can insert the line.....
MsgBox (Range("GROUP_1").Address)
I hope also that we can generate cell refs. as requested by this thread..
thanks a lot

"Gary''s Student" wrote:

In the last post we created the "GROUP_1" named range.

After the range has been created, add the line:

MsgBox (Range("GROUP_1").Address)

This lists the cells that comprise GROUP_1
--
Gary's Student


"rml" wrote:

Gary's student had given me a very simple yet productive reply to my previous
post DEFINE NAME. Now I need to expand this answer to a little more
dynamic....Based from my previous post, I need to have an automatic
generation of a list of all the reference cells in blank "Group_1", lets say
in Column IV. wherein each cell here will contain the cell reference (e.g.
A2, J4). Hope Gary's will reply...thanks...

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
rml rml is offline
external usenet poster
 
Posts: 50
Default Dynamic name

thanks Gary....I paste them all in the module....deleting the previous
lines...and when i change or blank some cells in GROUP1....the VBE window
pop-up with colored line....below...
...........
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("GROUP1")) Is Nothing Then
Else
Call main
End If
End Sub
..............
please take note that other worksheets contain other names....pls dont hang
up....thanks

"Gary''s Student" wrote:

Hi:

Put this in the module. It also addresses the GROUP_2 issue:

Sub listum()
With ActiveWorkbook
If .Names.Count 0 Then
For i = 1 To .Names.Count
MsgBox (i & " " & .Names(i).Name & " " & Range(.Names(i)).Address)
Next
End If
End With
End Sub

Sub main2()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 1 Then
For i = c To 1 Step -1
If .Names(i).Name = "GROUP_1" Then
.Names("GROUP_1").Delete
End If
If .Names(i).Name = "GROUP_2" Then
.Names("GROUP_2").Delete
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_1", RefersToR1C1:="=Sheet1!" & s
End If

Set rr = Nothing
For Each r In Range("GROUP1")
If Not IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_2", RefersToR1C1:="=Sheet1!" & s
End If

Call listum

End With
End Sub


listum() handles the messaging. The routine will also work if you have no
blanks or all blanks.
--
Gary''s Student


"rml" wrote:

Gary..this is the module....
________
Sub main()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 0 Then
For i = 1 To c
If .Names(i).Name = "GROUP_1" Then
.Names("GROUP_1").Delete
Exit For
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
s = rr.Address(ReferenceStyle:=xlR1C1)
MsgBox (s)
.Names.Add Name:="GROUP_1", RefersToR1C1:="=DYNANAME!" & s
End With
End Sub
_____

I dont know on which part i can insert the line.....
MsgBox (Range("GROUP_1").Address)
I hope also that we can generate cell refs. as requested by this thread..
thanks a lot

"Gary''s Student" wrote:

In the last post we created the "GROUP_1" named range.

After the range has been created, add the line:

MsgBox (Range("GROUP_1").Address)

This lists the cells that comprise GROUP_1
--
Gary's Student


"rml" wrote:

Gary's student had given me a very simple yet productive reply to my previous
post DEFINE NAME. Now I need to expand this answer to a little more
dynamic....Based from my previous post, I need to have an automatic
generation of a list of all the reference cells in blank "Group_1", lets say
in Column IV. wherein each cell here will contain the cell reference (e.g.
A2, J4). Hope Gary's will reply...thanks...



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Dynamic name

My mistake, not your problem.

We changed the sub name from main to main2. Therefore the worksheet code
must become:


Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("GROUP1")) Is Nothing Then
Else
Call main2
End If
End Sub
--
Gary's Student


"rml" wrote:

thanks Gary....I paste them all in the module....deleting the previous
lines...and when i change or blank some cells in GROUP1....the VBE window
pop-up with colored line....below...
..........
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("GROUP1")) Is Nothing Then
Else
Call main
End If
End Sub
.............
please take note that other worksheets contain other names....pls dont hang
up....thanks

"Gary''s Student" wrote:

Hi:

Put this in the module. It also addresses the GROUP_2 issue:

Sub listum()
With ActiveWorkbook
If .Names.Count 0 Then
For i = 1 To .Names.Count
MsgBox (i & " " & .Names(i).Name & " " & Range(.Names(i)).Address)
Next
End If
End With
End Sub

Sub main2()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 1 Then
For i = c To 1 Step -1
If .Names(i).Name = "GROUP_1" Then
.Names("GROUP_1").Delete
End If
If .Names(i).Name = "GROUP_2" Then
.Names("GROUP_2").Delete
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_1", RefersToR1C1:="=Sheet1!" & s
End If

Set rr = Nothing
For Each r In Range("GROUP1")
If Not IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_2", RefersToR1C1:="=Sheet1!" & s
End If

Call listum

End With
End Sub


listum() handles the messaging. The routine will also work if you have no
blanks or all blanks.
--
Gary''s Student


"rml" wrote:

Gary..this is the module....
________
Sub main()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 0 Then
For i = 1 To c
If .Names(i).Name = "GROUP_1" Then
.Names("GROUP_1").Delete
Exit For
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
s = rr.Address(ReferenceStyle:=xlR1C1)
MsgBox (s)
.Names.Add Name:="GROUP_1", RefersToR1C1:="=DYNANAME!" & s
End With
End Sub
_____

I dont know on which part i can insert the line.....
MsgBox (Range("GROUP_1").Address)
I hope also that we can generate cell refs. as requested by this thread..
thanks a lot

"Gary''s Student" wrote:

In the last post we created the "GROUP_1" named range.

After the range has been created, add the line:

MsgBox (Range("GROUP_1").Address)

This lists the cells that comprise GROUP_1
--
Gary's Student


"rml" wrote:

Gary's student had given me a very simple yet productive reply to my previous
post DEFINE NAME. Now I need to expand this answer to a little more
dynamic....Based from my previous post, I need to have an automatic
generation of a list of all the reference cells in blank "Group_1", lets say
in Column IV. wherein each cell here will contain the cell reference (e.g.
A2, J4). Hope Gary's will reply...thanks...

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
rml rml is offline
external usenet poster
 
Posts: 50
Default Dynamic name

I did change main into main2, as you told me....Very good...thanks...yet I am
quite bothered....there are consecutive pop ups and i have to hit "enter"s
and on the last pop-up...it says...
.........
Run-time error '1004':
Method 'Range of object '_Global failed
<buttons End....Debug....Help
.........
when i hit End, pop up close and when i go to the sheet, click the GROUP
NAME - it dims the correct cells....

Does the pop-up has told it correctly as "GLOBAL failed" ? I hope there will
be no conflict with the rest of the worksheets and functions....please help
to clarify....I think we are almost through....
thanks again....

"Gary''s Student" wrote:

My mistake, not your problem.

We changed the sub name from main to main2. Therefore the worksheet code
must become:


Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("GROUP1")) Is Nothing Then
Else
Call main2
End If
End Sub
--
Gary's Student


"rml" wrote:

thanks Gary....I paste them all in the module....deleting the previous
lines...and when i change or blank some cells in GROUP1....the VBE window
pop-up with colored line....below...
..........
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("GROUP1")) Is Nothing Then
Else
Call main
End If
End Sub
.............
please take note that other worksheets contain other names....pls dont hang
up....thanks

"Gary''s Student" wrote:

Hi:

Put this in the module. It also addresses the GROUP_2 issue:

Sub listum()
With ActiveWorkbook
If .Names.Count 0 Then
For i = 1 To .Names.Count
MsgBox (i & " " & .Names(i).Name & " " & Range(.Names(i)).Address)
Next
End If
End With
End Sub

Sub main2()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 1 Then
For i = c To 1 Step -1
If .Names(i).Name = "GROUP_1" Then
.Names("GROUP_1").Delete
End If
If .Names(i).Name = "GROUP_2" Then
.Names("GROUP_2").Delete
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_1", RefersToR1C1:="=Sheet1!" & s
End If

Set rr = Nothing
For Each r In Range("GROUP1")
If Not IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_2", RefersToR1C1:="=Sheet1!" & s
End If

Call listum

End With
End Sub


listum() handles the messaging. The routine will also work if you have no
blanks or all blanks.
--
Gary''s Student


"rml" wrote:

Gary..this is the module....
________
Sub main()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 0 Then
For i = 1 To c
If .Names(i).Name = "GROUP_1" Then
.Names("GROUP_1").Delete
Exit For
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
s = rr.Address(ReferenceStyle:=xlR1C1)
MsgBox (s)
.Names.Add Name:="GROUP_1", RefersToR1C1:="=DYNANAME!" & s
End With
End Sub
_____

I dont know on which part i can insert the line.....
MsgBox (Range("GROUP_1").Address)
I hope also that we can generate cell refs. as requested by this thread..
thanks a lot

"Gary''s Student" wrote:

In the last post we created the "GROUP_1" named range.

After the range has been created, add the line:

MsgBox (Range("GROUP_1").Address)

This lists the cells that comprise GROUP_1
--
Gary's Student


"rml" wrote:

Gary's student had given me a very simple yet productive reply to my previous
post DEFINE NAME. Now I need to expand this answer to a little more
dynamic....Based from my previous post, I need to have an automatic
generation of a list of all the reference cells in blank "Group_1", lets say
in Column IV. wherein each cell here will contain the cell reference (e.g.
A2, J4). Hope Gary's will reply...thanks...

  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Dynamic name

I can't replicate your error messages.

What was in your table when the error occurs??
--
Gary's Student


"rml" wrote:

I did change main into main2, as you told me....Very good...thanks...yet I am
quite bothered....there are consecutive pop ups and i have to hit "enter"s
and on the last pop-up...it says...
........
Run-time error '1004':
Method 'Range of object '_Global failed
<buttons End....Debug....Help
........
when i hit End, pop up close and when i go to the sheet, click the GROUP
NAME - it dims the correct cells....

Does the pop-up has told it correctly as "GLOBAL failed" ? I hope there will
be no conflict with the rest of the worksheets and functions....please help
to clarify....I think we are almost through....
thanks again....

"Gary''s Student" wrote:

My mistake, not your problem.

We changed the sub name from main to main2. Therefore the worksheet code
must become:


Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("GROUP1")) Is Nothing Then
Else
Call main2
End If
End Sub
--
Gary's Student


"rml" wrote:

thanks Gary....I paste them all in the module....deleting the previous
lines...and when i change or blank some cells in GROUP1....the VBE window
pop-up with colored line....below...
..........
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("GROUP1")) Is Nothing Then
Else
Call main
End If
End Sub
.............
please take note that other worksheets contain other names....pls dont hang
up....thanks

"Gary''s Student" wrote:

Hi:

Put this in the module. It also addresses the GROUP_2 issue:

Sub listum()
With ActiveWorkbook
If .Names.Count 0 Then
For i = 1 To .Names.Count
MsgBox (i & " " & .Names(i).Name & " " & Range(.Names(i)).Address)
Next
End If
End With
End Sub

Sub main2()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 1 Then
For i = c To 1 Step -1
If .Names(i).Name = "GROUP_1" Then
.Names("GROUP_1").Delete
End If
If .Names(i).Name = "GROUP_2" Then
.Names("GROUP_2").Delete
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_1", RefersToR1C1:="=Sheet1!" & s
End If

Set rr = Nothing
For Each r In Range("GROUP1")
If Not IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_2", RefersToR1C1:="=Sheet1!" & s
End If

Call listum

End With
End Sub


listum() handles the messaging. The routine will also work if you have no
blanks or all blanks.
--
Gary''s Student


"rml" wrote:

Gary..this is the module....
________
Sub main()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 0 Then
For i = 1 To c
If .Names(i).Name = "GROUP_1" Then
.Names("GROUP_1").Delete
Exit For
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
s = rr.Address(ReferenceStyle:=xlR1C1)
MsgBox (s)
.Names.Add Name:="GROUP_1", RefersToR1C1:="=DYNANAME!" & s
End With
End Sub
_____

I dont know on which part i can insert the line.....
MsgBox (Range("GROUP_1").Address)
I hope also that we can generate cell refs. as requested by this thread..
thanks a lot

"Gary''s Student" wrote:

In the last post we created the "GROUP_1" named range.

After the range has been created, add the line:

MsgBox (Range("GROUP_1").Address)

This lists the cells that comprise GROUP_1
--
Gary's Student


"rml" wrote:

Gary's student had given me a very simple yet productive reply to my previous
post DEFINE NAME. Now I need to expand this answer to a little more
dynamic....Based from my previous post, I need to have an automatic
generation of a list of all the reference cells in blank "Group_1", lets say
in Column IV. wherein each cell here will contain the cell reference (e.g.
A2, J4). Hope Gary's will reply...thanks...

  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
rml rml is offline
external usenet poster
 
Posts: 50
Default Dynamic name

the pop-up error occurs after i enter a value on a blank cell.

"Gary''s Student" wrote:

I can't replicate your error messages.

What was in your table when the error occurs??
--
Gary's Student


"rml" wrote:

I did change main into main2, as you told me....Very good...thanks...yet I am
quite bothered....there are consecutive pop ups and i have to hit "enter"s
and on the last pop-up...it says...
........
Run-time error '1004':
Method 'Range of object '_Global failed
<buttons End....Debug....Help
........
when i hit End, pop up close and when i go to the sheet, click the GROUP
NAME - it dims the correct cells....

Does the pop-up has told it correctly as "GLOBAL failed" ? I hope there will
be no conflict with the rest of the worksheets and functions....please help
to clarify....I think we are almost through....
thanks again....

"Gary''s Student" wrote:

My mistake, not your problem.

We changed the sub name from main to main2. Therefore the worksheet code
must become:


Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("GROUP1")) Is Nothing Then
Else
Call main2
End If
End Sub
--
Gary's Student


"rml" wrote:

thanks Gary....I paste them all in the module....deleting the previous
lines...and when i change or blank some cells in GROUP1....the VBE window
pop-up with colored line....below...
..........
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("GROUP1")) Is Nothing Then
Else
Call main
End If
End Sub
.............
please take note that other worksheets contain other names....pls dont hang
up....thanks

"Gary''s Student" wrote:

Hi:

Put this in the module. It also addresses the GROUP_2 issue:

Sub listum()
With ActiveWorkbook
If .Names.Count 0 Then
For i = 1 To .Names.Count
MsgBox (i & " " & .Names(i).Name & " " & Range(.Names(i)).Address)
Next
End If
End With
End Sub

Sub main2()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 1 Then
For i = c To 1 Step -1
If .Names(i).Name = "GROUP_1" Then
.Names("GROUP_1").Delete
End If
If .Names(i).Name = "GROUP_2" Then
.Names("GROUP_2").Delete
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_1", RefersToR1C1:="=Sheet1!" & s
End If

Set rr = Nothing
For Each r In Range("GROUP1")
If Not IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_2", RefersToR1C1:="=Sheet1!" & s
End If

Call listum

End With
End Sub


listum() handles the messaging. The routine will also work if you have no
blanks or all blanks.
--
Gary''s Student


"rml" wrote:

Gary..this is the module....
________
Sub main()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 0 Then
For i = 1 To c
If .Names(i).Name = "GROUP_1" Then
.Names("GROUP_1").Delete
Exit For
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
s = rr.Address(ReferenceStyle:=xlR1C1)
MsgBox (s)
.Names.Add Name:="GROUP_1", RefersToR1C1:="=DYNANAME!" & s
End With
End Sub
_____

I dont know on which part i can insert the line.....
MsgBox (Range("GROUP_1").Address)
I hope also that we can generate cell refs. as requested by this thread..
thanks a lot

"Gary''s Student" wrote:

In the last post we created the "GROUP_1" named range.

After the range has been created, add the line:

MsgBox (Range("GROUP_1").Address)

This lists the cells that comprise GROUP_1
--
Gary's Student


"rml" wrote:

Gary's student had given me a very simple yet productive reply to my previous
post DEFINE NAME. Now I need to expand this answer to a little more
dynamic....Based from my previous post, I need to have an automatic
generation of a list of all the reference cells in blank "Group_1", lets say
in Column IV. wherein each cell here will contain the cell reference (e.g.
A2, J4). Hope Gary's will reply...thanks...

  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Dynamic name

I don't get a pop-up error. Let's re-paste the code from scratch:
Sub listum()
With ActiveWorkbook
If .Names.Count 0 Then
For i = 1 To .Names.Count
MsgBox (i & " " & .Names(i).Name & " " & Range(.Names(i)).Address)
Next
End If
End With
End Sub
Sub main2()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 1 Then
For i = c To 1 Step -1
If .Names(i).Name = "GROUP_1" Then
.Names("GROUP_1").Delete
End If
If .Names(i).Name = "GROUP_2" Then
.Names("GROUP_2").Delete
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_1", RefersToR1C1:="=Sheet1!" & s
End If

Set rr = Nothing
For Each r In Range("GROUP1")
If Not IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_2", RefersToR1C1:="=Sheet1!" & s
End If

Call listum

End With
End Sub
--
Gary''s Student


"rml" wrote:

the pop-up error occurs after i enter a value on a blank cell.

"Gary''s Student" wrote:

I can't replicate your error messages.

What was in your table when the error occurs??
--
Gary's Student


"rml" wrote:

I did change main into main2, as you told me....Very good...thanks...yet I am
quite bothered....there are consecutive pop ups and i have to hit "enter"s
and on the last pop-up...it says...
........
Run-time error '1004':
Method 'Range of object '_Global failed
<buttons End....Debug....Help
........
when i hit End, pop up close and when i go to the sheet, click the GROUP
NAME - it dims the correct cells....

Does the pop-up has told it correctly as "GLOBAL failed" ? I hope there will
be no conflict with the rest of the worksheets and functions....please help
to clarify....I think we are almost through....
thanks again....

"Gary''s Student" wrote:

My mistake, not your problem.

We changed the sub name from main to main2. Therefore the worksheet code
must become:


Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("GROUP1")) Is Nothing Then
Else
Call main2
End If
End Sub
--
Gary's Student


"rml" wrote:

thanks Gary....I paste them all in the module....deleting the previous
lines...and when i change or blank some cells in GROUP1....the VBE window
pop-up with colored line....below...
..........
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("GROUP1")) Is Nothing Then
Else
Call main
End If
End Sub
.............
please take note that other worksheets contain other names....pls dont hang
up....thanks

"Gary''s Student" wrote:

Hi:

Put this in the module. It also addresses the GROUP_2 issue:

Sub listum()
With ActiveWorkbook
If .Names.Count 0 Then
For i = 1 To .Names.Count
MsgBox (i & " " & .Names(i).Name & " " & Range(.Names(i)).Address)
Next
End If
End With
End Sub

Sub main2()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 1 Then
For i = c To 1 Step -1
If .Names(i).Name = "GROUP_1" Then
.Names("GROUP_1").Delete
End If
If .Names(i).Name = "GROUP_2" Then
.Names("GROUP_2").Delete
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_1", RefersToR1C1:="=Sheet1!" & s
End If

Set rr = Nothing
For Each r In Range("GROUP1")
If Not IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_2", RefersToR1C1:="=Sheet1!" & s
End If

Call listum

End With
End Sub


listum() handles the messaging. The routine will also work if you have no
blanks or all blanks.
--
Gary''s Student


"rml" wrote:

Gary..this is the module....
________
Sub main()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 0 Then
For i = 1 To c
If .Names(i).Name = "GROUP_1" Then
.Names("GROUP_1").Delete
Exit For
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
s = rr.Address(ReferenceStyle:=xlR1C1)
MsgBox (s)
.Names.Add Name:="GROUP_1", RefersToR1C1:="=DYNANAME!" & s
End With
End Sub
_____

I dont know on which part i can insert the line.....
MsgBox (Range("GROUP_1").Address)
I hope also that we can generate cell refs. as requested by this thread..
thanks a lot

"Gary''s Student" wrote:

In the last post we created the "GROUP_1" named range.

After the range has been created, add the line:

MsgBox (Range("GROUP_1").Address)

This lists the cells that comprise GROUP_1
--
Gary's Student


"rml" wrote:

Gary's student had given me a very simple yet productive reply to my previous
post DEFINE NAME. Now I need to expand this answer to a little more
dynamic....Based from my previous post, I need to have an automatic
generation of a list of all the reference cells in blank "Group_1", lets say
in Column IV. wherein each cell here will contain the cell reference (e.g.
A2, J4). Hope Gary's will reply...thanks...



  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
rml rml is offline
external usenet poster
 
Posts: 50
Default Dynamic name

Your right, i make it on a new workbook...and it work as u say....thanks a
lot....looking forward to get more help from you.

"Gary''s Student" wrote:

I don't get a pop-up error. Let's re-paste the code from scratch:
Sub listum()
With ActiveWorkbook
If .Names.Count 0 Then
For i = 1 To .Names.Count
MsgBox (i & " " & .Names(i).Name & " " & Range(.Names(i)).Address)
Next
End If
End With
End Sub
Sub main2()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 1 Then
For i = c To 1 Step -1
If .Names(i).Name = "GROUP_1" Then
.Names("GROUP_1").Delete
End If
If .Names(i).Name = "GROUP_2" Then
.Names("GROUP_2").Delete
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_1", RefersToR1C1:="=Sheet1!" & s
End If

Set rr = Nothing
For Each r In Range("GROUP1")
If Not IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_2", RefersToR1C1:="=Sheet1!" & s
End If

Call listum

End With
End Sub
--
Gary''s Student


"rml" wrote:

the pop-up error occurs after i enter a value on a blank cell.

"Gary''s Student" wrote:

I can't replicate your error messages.

What was in your table when the error occurs??
--
Gary's Student


"rml" wrote:

I did change main into main2, as you told me....Very good...thanks...yet I am
quite bothered....there are consecutive pop ups and i have to hit "enter"s
and on the last pop-up...it says...
........
Run-time error '1004':
Method 'Range of object '_Global failed
<buttons End....Debug....Help
........
when i hit End, pop up close and when i go to the sheet, click the GROUP
NAME - it dims the correct cells....

Does the pop-up has told it correctly as "GLOBAL failed" ? I hope there will
be no conflict with the rest of the worksheets and functions....please help
to clarify....I think we are almost through....
thanks again....

"Gary''s Student" wrote:

My mistake, not your problem.

We changed the sub name from main to main2. Therefore the worksheet code
must become:


Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("GROUP1")) Is Nothing Then
Else
Call main2
End If
End Sub
--
Gary's Student


"rml" wrote:

thanks Gary....I paste them all in the module....deleting the previous
lines...and when i change or blank some cells in GROUP1....the VBE window
pop-up with colored line....below...
..........
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("GROUP1")) Is Nothing Then
Else
Call main
End If
End Sub
.............
please take note that other worksheets contain other names....pls dont hang
up....thanks

"Gary''s Student" wrote:

Hi:

Put this in the module. It also addresses the GROUP_2 issue:

Sub listum()
With ActiveWorkbook
If .Names.Count 0 Then
For i = 1 To .Names.Count
MsgBox (i & " " & .Names(i).Name & " " & Range(.Names(i)).Address)
Next
End If
End With
End Sub

Sub main2()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 1 Then
For i = c To 1 Step -1
If .Names(i).Name = "GROUP_1" Then
.Names("GROUP_1").Delete
End If
If .Names(i).Name = "GROUP_2" Then
.Names("GROUP_2").Delete
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_1", RefersToR1C1:="=Sheet1!" & s
End If

Set rr = Nothing
For Each r In Range("GROUP1")
If Not IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_2", RefersToR1C1:="=Sheet1!" & s
End If

Call listum

End With
End Sub


listum() handles the messaging. The routine will also work if you have no
blanks or all blanks.
--
Gary''s Student


"rml" wrote:

Gary..this is the module....
________
Sub main()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 0 Then
For i = 1 To c
If .Names(i).Name = "GROUP_1" Then
.Names("GROUP_1").Delete
Exit For
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
s = rr.Address(ReferenceStyle:=xlR1C1)
MsgBox (s)
.Names.Add Name:="GROUP_1", RefersToR1C1:="=DYNANAME!" & s
End With
End Sub
_____

I dont know on which part i can insert the line.....
MsgBox (Range("GROUP_1").Address)
I hope also that we can generate cell refs. as requested by this thread..
thanks a lot

"Gary''s Student" wrote:

In the last post we created the "GROUP_1" named range.

After the range has been created, add the line:

MsgBox (Range("GROUP_1").Address)

This lists the cells that comprise GROUP_1
--
Gary's Student


"rml" wrote:

Gary's student had given me a very simple yet productive reply to my previous
post DEFINE NAME. Now I need to expand this answer to a little more
dynamic....Based from my previous post, I need to have an automatic
generation of a list of all the reference cells in blank "Group_1", lets say
in Column IV. wherein each cell here will contain the cell reference (e.g.
A2, J4). Hope Gary's will reply...thanks...

  #12   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Dynamic name

You are very welcome!!
--
Gary's Student


"rml" wrote:

Your right, i make it on a new workbook...and it work as u say....thanks a
lot....looking forward to get more help from you.

"Gary''s Student" wrote:

I don't get a pop-up error. Let's re-paste the code from scratch:
Sub listum()
With ActiveWorkbook
If .Names.Count 0 Then
For i = 1 To .Names.Count
MsgBox (i & " " & .Names(i).Name & " " & Range(.Names(i)).Address)
Next
End If
End With
End Sub
Sub main2()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 1 Then
For i = c To 1 Step -1
If .Names(i).Name = "GROUP_1" Then
.Names("GROUP_1").Delete
End If
If .Names(i).Name = "GROUP_2" Then
.Names("GROUP_2").Delete
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_1", RefersToR1C1:="=Sheet1!" & s
End If

Set rr = Nothing
For Each r In Range("GROUP1")
If Not IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_2", RefersToR1C1:="=Sheet1!" & s
End If

Call listum

End With
End Sub
--
Gary''s Student


"rml" wrote:

the pop-up error occurs after i enter a value on a blank cell.

"Gary''s Student" wrote:

I can't replicate your error messages.

What was in your table when the error occurs??
--
Gary's Student


"rml" wrote:

I did change main into main2, as you told me....Very good...thanks...yet I am
quite bothered....there are consecutive pop ups and i have to hit "enter"s
and on the last pop-up...it says...
........
Run-time error '1004':
Method 'Range of object '_Global failed
<buttons End....Debug....Help
........
when i hit End, pop up close and when i go to the sheet, click the GROUP
NAME - it dims the correct cells....

Does the pop-up has told it correctly as "GLOBAL failed" ? I hope there will
be no conflict with the rest of the worksheets and functions....please help
to clarify....I think we are almost through....
thanks again....

"Gary''s Student" wrote:

My mistake, not your problem.

We changed the sub name from main to main2. Therefore the worksheet code
must become:


Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("GROUP1")) Is Nothing Then
Else
Call main2
End If
End Sub
--
Gary's Student


"rml" wrote:

thanks Gary....I paste them all in the module....deleting the previous
lines...and when i change or blank some cells in GROUP1....the VBE window
pop-up with colored line....below...
..........
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("GROUP1")) Is Nothing Then
Else
Call main
End If
End Sub
.............
please take note that other worksheets contain other names....pls dont hang
up....thanks

"Gary''s Student" wrote:

Hi:

Put this in the module. It also addresses the GROUP_2 issue:

Sub listum()
With ActiveWorkbook
If .Names.Count 0 Then
For i = 1 To .Names.Count
MsgBox (i & " " & .Names(i).Name & " " & Range(.Names(i)).Address)
Next
End If
End With
End Sub

Sub main2()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 1 Then
For i = c To 1 Step -1
If .Names(i).Name = "GROUP_1" Then
.Names("GROUP_1").Delete
End If
If .Names(i).Name = "GROUP_2" Then
.Names("GROUP_2").Delete
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_1", RefersToR1C1:="=Sheet1!" & s
End If

Set rr = Nothing
For Each r In Range("GROUP1")
If Not IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
If rr Is Nothing Then
Else
s = rr.Address(ReferenceStyle:=xlR1C1)
.Names.Add Name:="GROUP_2", RefersToR1C1:="=Sheet1!" & s
End If

Call listum

End With
End Sub


listum() handles the messaging. The routine will also work if you have no
blanks or all blanks.
--
Gary''s Student


"rml" wrote:

Gary..this is the module....
________
Sub main()
Dim r As Range
Dim rr As Range
Dim s As String
With ActiveWorkbook
c = .Names.Count
If c 0 Then
For i = 1 To c
If .Names(i).Name = "GROUP_1" Then
.Names("GROUP_1").Delete
Exit For
End If
Next
End If
For Each r In Range("GROUP1")
If IsEmpty(r) Then
If rr Is Nothing Then
Set rr = r
Else
Set rr = Union(rr, r)
End If
End If
Next
s = rr.Address(ReferenceStyle:=xlR1C1)
MsgBox (s)
.Names.Add Name:="GROUP_1", RefersToR1C1:="=DYNANAME!" & s
End With
End Sub
_____

I dont know on which part i can insert the line.....
MsgBox (Range("GROUP_1").Address)
I hope also that we can generate cell refs. as requested by this thread..
thanks a lot

"Gary''s Student" wrote:

In the last post we created the "GROUP_1" named range.

After the range has been created, add the line:

MsgBox (Range("GROUP_1").Address)

This lists the cells that comprise GROUP_1
--
Gary's Student


"rml" wrote:

Gary's student had given me a very simple yet productive reply to my previous
post DEFINE NAME. Now I need to expand this answer to a little more
dynamic....Based from my previous post, I need to have an automatic
generation of a list of all the reference cells in blank "Group_1", lets say
in Column IV. wherein each cell here will contain the cell reference (e.g.
A2, J4). Hope Gary's will reply...thanks...

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Stacked Column Chart Help ksp Charts and Charting in Excel 2 June 20th 06 01:15 AM
Dynamic Range with unused formula messing up x axis on dynamic graph [email protected] Charts and Charting in Excel 2 February 2nd 06 08:02 PM
Dynamic Ranges: Speed Issue Sige Excel Worksheet Functions 5 December 12th 05 09:28 PM
using LOOKUP instead of IF on dynamic row Jay C Excel Worksheet Functions 0 April 8th 05 12:56 PM
Can't create dynamic charts Brian Sells Charts and Charting in Excel 7 March 22nd 05 04:23 AM


All times are GMT +1. The time now is 11:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"