Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I have a defined NAME(e.g. GROUP1) of a group of Cells in a table. Within
this group of cells, I had defined another NAME (e.g. GROUP_1) for those blank cells that I gathered. My problem is how to make dynamic changes on the referred cells of GROUP_1, say if I place value in one blank cell, the GROUP_1 will be updated. GROUP1 : A1:J5 GROUP_1 : A2,J4 <BLANK CELLS Editing the GROUP1, I delete the content of B1 and B2... Hence, I need GROUP_1 to recognize the changes GROUP_1 must be : A2,J4,B1,B2 I hope this is not another unsolved problem in our forum.... thanks a lot... rml |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Assuming that GROUP1 and GROUP_1 have already been defined. We need two
pieces of code: 1. worksheet code: Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("GROUP1")) Is Nothing Then Else Call main End If End Sub so if any changes are madein GROUP1, main() is called 2. In a standard 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:="=Sheet1!" & s End With End Sub The code checks to see if GROUP_1 exists. If it exists, it is deleted. The code then re-constructs GROUP_1 from scratch, UNIONing in empty cells. The Named Range is then re-added to the workbook with the most current empty cell set. -- Gary's Student "rml" wrote: I have a defined NAME(e.g. GROUP1) of a group of Cells in a table. Within this group of cells, I had defined another NAME (e.g. GROUP_1) for those blank cells that I gathered. My problem is how to make dynamic changes on the referred cells of GROUP_1, say if I place value in one blank cell, the GROUP_1 will be updated. GROUP1 : A1:J5 GROUP_1 : A2,J4 <BLANK CELLS Editing the GROUP1, I delete the content of B1 and B2... Hence, I need GROUP_1 to recognize the changes GROUP_1 must be : A2,J4,B1,B2 I hope this is not another unsolved problem in our forum.... thanks a lot... rml |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
CONGRATS...you're a wizard....hope u can generate more dynamic questions that
i will post sooner....thanks a lot. "Gary''s Student" wrote: Assuming that GROUP1 and GROUP_1 have already been defined. We need two pieces of code: 1. worksheet code: Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("GROUP1")) Is Nothing Then Else Call main End If End Sub so if any changes are madein GROUP1, main() is called 2. In a standard 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:="=Sheet1!" & s End With End Sub The code checks to see if GROUP_1 exists. If it exists, it is deleted. The code then re-constructs GROUP_1 from scratch, UNIONing in empty cells. The Named Range is then re-added to the workbook with the most current empty cell set. -- Gary's Student "rml" wrote: I have a defined NAME(e.g. GROUP1) of a group of Cells in a table. Within this group of cells, I had defined another NAME (e.g. GROUP_1) for those blank cells that I gathered. My problem is how to make dynamic changes on the referred cells of GROUP_1, say if I place value in one blank cell, the GROUP_1 will be updated. GROUP1 : A1:J5 GROUP_1 : A2,J4 <BLANK CELLS Editing the GROUP1, I delete the content of B1 and B2... Hence, I need GROUP_1 to recognize the changes GROUP_1 must be : A2,J4,B1,B2 I hope this is not another unsolved problem in our forum.... thanks a lot... rml |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Gary, could you extend help a little bit....
I forgot that I also have a defined name GROUP_2,within the GROUP1,which contains values, How can we do dynamic change to GROUP_2... I dont know VBE...thanks again. "rml" wrote: CONGRATS...you're a wizard....hope u can generate more dynamic questions that i will post sooner....thanks a lot. "Gary''s Student" wrote: Assuming that GROUP1 and GROUP_1 have already been defined. We need two pieces of code: 1. worksheet code: Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("GROUP1")) Is Nothing Then Else Call main End If End Sub so if any changes are madein GROUP1, main() is called 2. In a standard 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:="=Sheet1!" & s End With End Sub The code checks to see if GROUP_1 exists. If it exists, it is deleted. The code then re-constructs GROUP_1 from scratch, UNIONing in empty cells. The Named Range is then re-added to the workbook with the most current empty cell set. -- Gary's Student "rml" wrote: I have a defined NAME(e.g. GROUP1) of a group of Cells in a table. Within this group of cells, I had defined another NAME (e.g. GROUP_1) for those blank cells that I gathered. My problem is how to make dynamic changes on the referred cells of GROUP_1, say if I place value in one blank cell, the GROUP_1 will be updated. GROUP1 : A1:J5 GROUP_1 : A2,J4 <BLANK CELLS Editing the GROUP1, I delete the content of B1 and B2... Hence, I need GROUP_1 to recognize the changes GROUP_1 must be : A2,J4,B1,B2 I hope this is not another unsolved problem in our forum.... thanks a lot... rml |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Tell me more about GROUP_2.
-- Gary's Student "rml" wrote: Gary, could you extend help a little bit.... I forgot that I also have a defined name GROUP_2,within the GROUP1,which contains values, How can we do dynamic change to GROUP_2... I dont know VBE...thanks again. "rml" wrote: CONGRATS...you're a wizard....hope u can generate more dynamic questions that i will post sooner....thanks a lot. "Gary''s Student" wrote: Assuming that GROUP1 and GROUP_1 have already been defined. We need two pieces of code: 1. worksheet code: Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("GROUP1")) Is Nothing Then Else Call main End If End Sub so if any changes are madein GROUP1, main() is called 2. In a standard 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:="=Sheet1!" & s End With End Sub The code checks to see if GROUP_1 exists. If it exists, it is deleted. The code then re-constructs GROUP_1 from scratch, UNIONing in empty cells. The Named Range is then re-added to the workbook with the most current empty cell set. -- Gary's Student "rml" wrote: I have a defined NAME(e.g. GROUP1) of a group of Cells in a table. Within this group of cells, I had defined another NAME (e.g. GROUP_1) for those blank cells that I gathered. My problem is how to make dynamic changes on the referred cells of GROUP_1, say if I place value in one blank cell, the GROUP_1 will be updated. GROUP1 : A1:J5 GROUP_1 : A2,J4 <BLANK CELLS Editing the GROUP1, I delete the content of B1 and B2... Hence, I need GROUP_1 to recognize the changes GROUP_1 must be : A2,J4,B1,B2 I hope this is not another unsolved problem in our forum.... thanks a lot... rml |
#6
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
e.g.
GROUP1 : A1:J10 GROUP_1 : blank cells within GROUP1 GROUP_2 : non-blank cells within GROUP1 GROUP1 = GROUP_1 + GROUP_2 thanks rml "Gary''s Student" wrote: Tell me more about GROUP_2. -- Gary's Student "rml" wrote: Gary, could you extend help a little bit.... I forgot that I also have a defined name GROUP_2,within the GROUP1,which contains values, How can we do dynamic change to GROUP_2... I dont know VBE...thanks again. "rml" wrote: CONGRATS...you're a wizard....hope u can generate more dynamic questions that i will post sooner....thanks a lot. "Gary''s Student" wrote: Assuming that GROUP1 and GROUP_1 have already been defined. We need two pieces of code: 1. worksheet code: Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("GROUP1")) Is Nothing Then Else Call main End If End Sub so if any changes are madein GROUP1, main() is called 2. In a standard 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:="=Sheet1!" & s End With End Sub The code checks to see if GROUP_1 exists. If it exists, it is deleted. The code then re-constructs GROUP_1 from scratch, UNIONing in empty cells. The Named Range is then re-added to the workbook with the most current empty cell set. -- Gary's Student "rml" wrote: I have a defined NAME(e.g. GROUP1) of a group of Cells in a table. Within this group of cells, I had defined another NAME (e.g. GROUP_1) for those blank cells that I gathered. My problem is how to make dynamic changes on the referred cells of GROUP_1, say if I place value in one blank cell, the GROUP_1 will be updated. GROUP1 : A1:J5 GROUP_1 : A2,J4 <BLANK CELLS Editing the GROUP1, I delete the content of B1 and B2... Hence, I need GROUP_1 to recognize the changes GROUP_1 must be : A2,J4,B1,B2 I hope this is not another unsolved problem in our forum.... thanks a lot... rml |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formula via Define Name (not working) | Excel Discussion (Misc queries) | |||
define header cells | Excel Discussion (Misc queries) | |||
Define a chart using VBA | Charts and Charting in Excel | |||
alternate UI for Define Names ?? | Excel Discussion (Misc queries) | |||
Define Name use in Macros | Excel Discussion (Misc queries) |