Wednesday, September 25, 2019

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

This is how to remove the selection and to speed up the process:



With Sheets(Currentsheetname).Range("A" & SelRowNumber + 1 & ":A" & lastrow).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



Always try to avoid seletction and activation in VBA.

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...