ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   2 Private Sub Worksheet_SelectionChange? (https://www.excelbanter.com/excel-programming/352757-2-private-sub-worksheet_selectionchange.html)

AJPendragon[_2_]

2 Private Sub Worksheet_SelectionChange?
 
I already have 1 Private Sub Worksheet_SelectionChange(ByVal Target As Range)
which allows a combo box to appear on a validation list, but I want to add
another "SelectionChange" to allow a cell to always show the current cell a
cursor is in.

The macro falls over - ambiguous name - I presume you cannot have two
Private Sub Worksheet_SelectionChange(ByVal Target As Range) named the same
in 1 sheet.

Is there a way around this - renaming one does not seem to work.

Sorry but my knowledge of VBA is extremely limited.

Thanks


Andrew

Tom Ogilvy

2 Private Sub Worksheet_SelectionChange?
 
Put both activities in the same single SelectionChange procedure.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
' combobox code

' other code
Range("A1").Value = Target.Address
end Sub

--
Regards,
Tom Ogilvy


"AJPendragon" wrote in message
...
I already have 1 Private Sub Worksheet_SelectionChange(ByVal Target As

Range)
which allows a combo box to appear on a validation list, but I want to add
another "SelectionChange" to allow a cell to always show the current cell

a
cursor is in.

The macro falls over - ambiguous name - I presume you cannot have two
Private Sub Worksheet_SelectionChange(ByVal Target As Range) named the

same
in 1 sheet.

Is there a way around this - renaming one does not seem to work.

Sorry but my knowledge of VBA is extremely limited.

Thanks


Andrew





All times are GMT +1. The time now is 01:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com