drrocket5292
Technical User
I created a little program that uses the selection change event in excel. basically if someone clicks on a cell with data in it in column A then the spreadhseet drills down on that selection and returns a bunch of information based on what the user selected. this works fine except for when a user highlights the entire row instead of clicking on just the cell in Column A. I can error trap and have a msgbox pop up saying not to do that but what i would like to do is when there are multiple cells selected i would like my program to only recognize the cell in the top left of the selection as being selected but I can't figure out how to do that. Any idea what I would have to add to the following lines of code to essentially make that happen?
Private Sub App1_SheetSelectionChange(ByVal sh As Object, ByVal Target As Range)
If Target.Column = 1 And Target.Row >= 4 And Target.Row <= x Then
I've tried using the following line but it errors out saying its an ivalid property assignment:
if target.columns.count > 1 then
target.column = 1
end if
Private Sub App1_SheetSelectionChange(ByVal sh As Object, ByVal Target As Range)
If Target.Column = 1 And Target.Row >= 4 And Target.Row <= x Then
I've tried using the following line but it errors out saying its an ivalid property assignment:
if target.columns.count > 1 then
target.column = 1
end if