Agnarr
New Member
- Joined
- Jan 15, 2023
- Messages
- 29
- Office Version
- 365
- Platform
- Windows
Hello everybody and you all do an amazing work.
I need your help please and i apologize in advance for any mistakes (English is not my native language).
I wanted to make a log where you type a code and have it replaced by the name of a client. The brilliant bebo021999 gave me a quick and easy solution but there's one problem.
I have a button that completely empties out the log but now it lags incredibly. Like it tries to read each row and then clears contents and while it does so, resets the height as well.
Is there a workaround to this lagging problem?
The code for the replacement by bebo021999 is this:
and the module to empty out the log is this:
Sorry but I don't know how to upload the workbook here yet.
Thank you all in advance. Any help will be appreciated.
I need your help please and i apologize in advance for any mistakes (English is not my native language).
I wanted to make a log where you type a code and have it replaced by the name of a client. The brilliant bebo021999 gave me a quick and easy solution but there's one problem.
I have a button that completely empties out the log but now it lags incredibly. Like it tries to read each row and then clears contents and while it does so, resets the height as well.
Is there a workaround to this lagging problem?
The code for the replacement by bebo021999 is this:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim inputR As Range, codeR As Range, cell As Range
Dim f
Set inputR = Range("C14:C208") ' range of input data. adjust to actual range
Set codeR = Worksheets("ÊÙÄ.ÐÅË.").Range("A1:B300") ' assums sheet "code", range "A1:B3" contains lookup code. Adjust to actual sheet-range
If Intersect(Target, inputR) Is Nothing Then Exit Sub
With Application
.EnableEvents = False
For Each cell In Target
Set f = codeR.Find(cell.Value, , , xlWhole)
If Not f Is Nothing Then cell.Value = f.Offset(, 1).Value
Next
.EnableEvents = True
End With
End Sub
and the module to empty out the log is this:
VBA Code:
Sub ClearLogContents()
Range("B14:L208").ClearContents
Range("C10:F11").ClearContents
Range("H10:L11").ClearContents
End Sub
Sorry but I don't know how to upload the workbook here yet.
Thank you all in advance. Any help will be appreciated.