Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 7
Default DV0017 - Debra's Validation Code

I created a DV with multiple selection using Debra's code and made minor
modification. It worked before but now it does not work.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo exitHandler

Dim rngDV As Range
Dim lRow As Long
Dim lCol As Long

lCol = Target.Column 'column with data validation cell

If Target.Count 1 Then GoTo exitHandler

On Error Resume Next
Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo exitHandler
If rngDV Is Nothing Then GoTo exitHandler
If Intersect(Target, rngDV) Is Nothing Then
'do nothing
Else
If Target.Value = "" Then GoTo exitHandler
Application.EnableEvents = False
Select Case Target.Column
Case 3
If Target.Offset(0, 1).Value = "" Then
lRow = Target.Row
Else
lRow = Cells(Rows.Count, lCol + 1).End(xlUp).Row + 1
End If
Cells(lRow, lCol + 1).Value = Target.Value
End Select

End If

exitHandler:
Application.EnableEvents = True

End Sub

Help
--
mmk
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 22,906
Default DV0017 - Debra's Validation Code

Increments selected choices from any DV cell into single cells down adjacent
column.

What do you want it to do?


Gord Dibben MS Excel MVP

On Mon, 14 Sep 2009 08:09:02 -0700, MKuria wrote:

I created a DV with multiple selection using Debra's code and made minor
modification. It worked before but now it does not work.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo exitHandler

Dim rngDV As Range
Dim lRow As Long
Dim lCol As Long

lCol = Target.Column 'column with data validation cell

If Target.Count 1 Then GoTo exitHandler

On Error Resume Next
Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo exitHandler
If rngDV Is Nothing Then GoTo exitHandler
If Intersect(Target, rngDV) Is Nothing Then
'do nothing
Else
If Target.Value = "" Then GoTo exitHandler
Application.EnableEvents = False
Select Case Target.Column
Case 3
If Target.Offset(0, 1).Value = "" Then
lRow = Target.Row
Else
lRow = Cells(Rows.Count, lCol + 1).End(xlUp).Row + 1
End If
Cells(lRow, lCol + 1).Value = Target.Value
End Select

End If

exitHandler:
Application.EnableEvents = True

End Sub

Help


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
date code validation TUNGANA KURMA RAJU Excel Discussion (Misc queries) 0 June 3rd 08 10:47 AM
Zip Code Validation - length =5 or 9 Daron Excel Discussion (Misc queries) 11 November 5th 07 04:56 PM
Code to find data validation in a cell DaveO[_2_] Excel Discussion (Misc queries) 1 March 19th 07 05:53 PM
Validation of Postal Code Veronika Excel Worksheet Functions 1 December 16th 05 09:42 PM
Validation code for macro to run [email protected] Excel Discussion (Misc queries) 1 December 9th 05 02:28 PM


All times are GMT +1. The time now is 05:09 AM.

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"