ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Temporary borders appear (https://www.excelbanter.com/excel-programming/381338-re-temporary-borders-appear.html)

[email protected]

Temporary borders appear
 
set

Application.CutCopyMode=false

BUT you might want to try doing away with the copy and paste altogether
- for example (if I've read the process correctly)

ActiveCell.value=myRng.Cells(1).Offset(.ListIndex - 1).value

would do a similar process (albeit only with the value of the cell)

Arran wrote:

The code below works but after making selection from the drop down and moving
the active cell a border is being left around the cell where the selection
was made. It is more the annoyance than anything as I only have to select
another sheet and when I go back to the initial sheet all borders are removed.
What changes to the code are required to stop this?

Thank you in advance
Arran

Sub control_on_worksheet()
Dim myDD As DropDown
Dim myRng As Range
Set myDD = ActiveSheet.DropDowns(Application.Caller)
With myDD
Set myRng = Application.Range(.ListFillRange)
If Application.CountA(myRng) = 0 Then
MsgBox "Add names to Rangelist Sheet"
Else
If .ListIndex = 0 Then
'do nothing
Else
myRng.Cells(1).Offset(.ListIndex - 1).Copy _
Destination:=ActiveCell
.ListIndex = 0
End If
End If
End With
End Sub




All times are GMT +1. The time now is 03:32 AM.

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