Wednesday, 5 July 2017

excel - VBA - Too Slow with With and selection Command. How Can I optimize it better to run faster?

I am selecting a range and using that selection inside the With Command and as you all know, the .Selection command is going to slow down the process. What is the better way to write this code, to run it faster?



Here goes my code:




Sheets(Currentsheetname).Range("A" & SelRowNumber + 1 & ":A" & lastrow).Select

With .Selection.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="Remove"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""

.ErrorTitle = "Warning"
.InputMessage = ""
.ErrorMessage = "Please select a value from the list available in the selected cell."
.ShowInput = True
.ShowError = True
End With

No comments:

Post a Comment

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...