LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Attn: DP - Automating a dependent list - Code not working

I had gotten some help to create the following code and could not get it to
work when I copied the spreadsheet to another workbook. It was for a
spreadsheet with two columns of about 21 rows and was supposed to automate a
dependent list, such that a user would select a value in the first column
which would generate a value in the second column but if they made a change
to the first column, the second column would reset to the first value of the
dependent list, forcing them to reselect the value in the dependent list.
(Let me know if this is unclear)
My problem is, the code does not work and I cannot figure out what the code
means line by lin - can you help please?

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo errHandler
Dim rng As Range
Dim intCounter As Integer
Dim varCellD As Variant
Dim varCellE As Variant

For intCounter = 4 To 25
varCellD = "D" & intCounter
varCellE = "E" & intCounter
Set curCell = Worksheets("Diveo Datacenter").Cells(2, intCounter)
If Not Intersect(Target, Me.Range(varCellD)) Is Nothing Then
If Target.Count 1 Then Exit Sub
Application.EnableEvents = False
Set rng = ActiveWorkbook.Names(Target.Value).RefersToRange
Me.Range(varCellE).Value = rng.Offset(0, 0).Value
End If
Next intCounter

errHandler:
MsgBox "Could not change dependent cell"
Exit Sub

exitHandler:
Application.EnableEvents = True
Exit Sub

End Sub

 
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
Return a list dependent upon the selection of a preceeding list Aja K Excel Worksheet Functions 4 April 11th 07 07:48 PM
ATTN : Ron (Multiple Dependent DV List Auto Update) Rajat Excel Worksheet Functions 0 December 1st 06 01:31 PM
ATTN : Ron (Multiple Dependent DV List Auto Update) Rajat Excel Worksheet Functions 2 November 30th 06 07:21 AM
Excel 2003 VBA Help not working when automating via VB 6 Howard Kaikow Excel Programming 6 November 27th 03 03:39 AM
Automating GoalSeek - why doesn't this code work? Jeff Donville Excel Programming 0 September 11th 03 04:55 PM


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

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

About Us

"It's about Microsoft Excel"