Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Return a list dependent upon the selection of a preceeding list | Excel Worksheet Functions | |||
ATTN : Ron (Multiple Dependent DV List Auto Update) | Excel Worksheet Functions | |||
ATTN : Ron (Multiple Dependent DV List Auto Update) | Excel Worksheet Functions | |||
Excel 2003 VBA Help not working when automating via VB 6 | Excel Programming | |||
Automating GoalSeek - why doesn't this code work? | Excel Programming |