If you are an Excellent Excel VBA Coder, Can you find any errors or inefficient coding…
- User
If you are an Excellent Excel VBA Coder, Can you find any errors or inefficient coding in the VBA event below. When I run the code some of the remind values found are either missing or not placed in the correct place. Is any of the searched values stored to a memory variable? if so can this be cleared, set to Nothing after the code has completed.
Public Sub AllReminders()
Application.ScreenUpdating = False Application.EnableEvents = False
Dim myRange As Range Set myRange = Range("A11:A20") myRange.Rows.RowHeight = 1
Dim ws As Worksheet Dim remindws As Worksheet Dim lastRow As Long Dim remindRow As Long Dim i As Long
Set remindws = ThisWorkbook.Worksheets("Reminders") remindws.Range("D23:G" & remindws.Rows.count).ClearContents
For Each ws In ThisWorkbook.Worksheets If Len(ws.Name) = 3 Then lastRow = ws.Cells(ws.Rows.count, "B").End(xlUp).Row 'find last row in column B
For i = 1 To lastRow If ws.Cells(i, "B").Value = "Remind" Then remindRow = remindws.Cells(remindws.Rows.count, "D").End(xlUp).Row + 1 remindws.Cells(remindRow, "D").Value = ws.Cells(i, "J").Value remindws.Cells(remindRow, "E").Value = ws.Cells(i, "L").Value remindws.Cells(remindRow, "F").Value = ws.Cells(i, "C").Value remindws.Cells(remindRow, "G").Value = ws.Cells(i, "E").Value End If Next i End If Next ws
Application.EnableEvents = True Application.ScreenUpdating = True
remindws.Range("H23:H140").Calculate
End Sub
- Assistant