PC Review


Reply
Thread Tools Rate Thread

Dinamic Validations Lists

 
 
Angeles
Guest
Posts: n/a
 
      22nd Nov 2007
Hi I am using in the Validation the formula :
=OFFSET(INDIRECT(SUBSTITUTE($A40,"
","")),0,0,COUNTA(INDIRECT(SUBSTITUTE($A40," ","")&"Col")),1)

And also I am using the next code for letting add new elements to my lists :
Private Sub Worksheet_Change(ByVal Target As Range)
Dim aux As String
Dim i As Integer
Dim allowedVal As Boolean
On Error Resume Next
Dim ws As Worksheet
Dim rngDV As Range
Dim rng As Range

'Add items to list
If (Target.row >= 13 And Target.row <= 31) And (Target.Column = 12 Or
Target.Column = 15 Or Target.Column = 18 Or Target.Column = 21 Or
Target.Column = 24 Or Target.Column = 27 Or Target.Column = 30 Or
Target.Column = 33 Or Target.Column = 36 Or Target.Column = 39) Then
If Target.count > 1 Then Exit Sub
Set ws = Worksheets("DATA-GEx Data")
If Target.row > 1 Then

On Error Resume Next
Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo 0
If rngDV Is Nothing Then Exit Sub
If Intersect(Target, rngDV) Is Nothing Then Exit Sub
Set rng = ws.Range(ActiveWorkbook.Sheets("Part Appl
Guidelines").Cells(Target.row + 27, 1).Value)
If Application.WorksheetFunction.CountIf(rng, Target.Value) Then
Exit Sub
Else
i = ws.Cells(Rows.count, rng.Column).End(xlUp).row + 1
'we need to resize the range
ws.Cells(i, rng.Column).Value = Target.Value

Set rng = ws.Range(ActiveWorkbook.Sheets("Part Appl
Guidelines").Cells(Target.row + 27, 1).Value)
'With Worksheets("DATA-GEx Data").Range("J" & Trim(Str(row))).Font
' .ColorIndex = 3
' .Size = 10
' .Bold = False
'End With
rng.Sort Key1:=ws.Cells(1, rng.Column), _
Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom
End If
End If
End If

But when I add a new element to the list ... the element is added but the
range is not being resized , I think so because it is letting to add the same
element more than once.

Could you please help me ?

Regards
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dinamic Tables Maradona Microsoft Excel Crashes 0 12th Dec 2007 12:29 PM
Dinamic images Damir Microsoft ASP .NET 0 6th May 2005 08:02 AM
MFC dinamic creation Rajko Microsoft VC .NET 0 16th May 2004 10:41 AM
Size Limits of Distribution Lists & How to use existing lists as sources from which to create other lists =?Utf-8?B?aGFiYWRhaTE=?= Microsoft Outlook Discussion 1 27th Apr 2004 04:15 PM
Re: Dinamic Table Peo Sjoblom Microsoft Excel Worksheet Functions 0 22nd Aug 2003 07:16 PM


Features
 

Advertising
 

Newsgroups
 


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