Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Help w/ modifying code... pull down menu

I'm trying to modify the following code so that instead of the cells
populating the "next column and down" when selecting from the pull down menu,
it populates the cell beneath the pull down menu. Any help/tips/suggestions
where to look, is greatly appreciated. (I apologize in advance if this
question seems simple but my skillset in this area is practically
non-existent).

Laura

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 7, 12, 14, 18
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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Help w/ modifying code... pull down menu

Change

lRow = Cells(Rows.Count, lCol + 1).End(xlUp).Row + 1
End If
Cells(lRow, lCol + 1).Value = Target.Value

to

lRow = Cells(Rows.Count, lCol).End(xlUp).Row + 1
End If
Cells(lRow, lCol).Value = Target.Value


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Laura L" wrote in message
...
I'm trying to modify the following code so that instead of the cells
populating the "next column and down" when selecting from the pull down
menu,
it populates the cell beneath the pull down menu. Any
help/tips/suggestions
where to look, is greatly appreciated. (I apologize in advance if this
question seems simple but my skillset in this area is practically
non-existent).

Laura

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 7, 12, 14, 18
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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Help w/ modifying code... pull down menu

Thank you so much. It works.

Is there a way to add a line that would allow you to click on a cell below
the pull-down and then choose from the pull down? Right now, if after you've
made selections you click on a different cell and then you go back to
continue with the list, the code doesn't work any more... is there any way to
fix this?

Laura

"Bob Phillips" wrote:

Change

lRow = Cells(Rows.Count, lCol + 1).End(xlUp).Row + 1
End If
Cells(lRow, lCol + 1).Value = Target.Value

to

lRow = Cells(Rows.Count, lCol).End(xlUp).Row + 1
End If
Cells(lRow, lCol).Value = Target.Value


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Laura L" wrote in message
...
I'm trying to modify the following code so that instead of the cells
populating the "next column and down" when selecting from the pull down
menu,
it populates the cell beneath the pull down menu. Any
help/tips/suggestions
where to look, is greatly appreciated. (I apologize in advance if this
question seems simple but my skillset in this area is practically
non-existent).

Laura

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 7, 12, 14, 18
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





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
Modifying Data in Drop Down Menu GooseMA Excel Worksheet Functions 2 May 23rd 09 08:43 PM
modifying Ron DeBruin's menu macro SteveDB1 Excel Programming 1 April 12th 07 03:58 PM
Pull Down Menu Bar JB in Kansas Excel Discussion (Misc queries) 2 May 30th 05 02:20 PM
pull down menu ben Excel Programming 3 February 2nd 04 08:12 PM
Modifying the right-click popup menu of a shape Don Lopez Excel Programming 2 July 23rd 03 10:03 PM


All times are GMT +1. The time now is 02:23 AM.

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"