Hi,
I was hoping someone could help me with my code. I don't normally write code so I've been doing a lot of research to figure out how to achieve this request.
I wrote a formula that accomplished it but because of the amount of data, it was really slow and took a long time to populate. I believe a VBA code could lessen the processing time.
see code below:
Private Sub CommandButton1_Click()
'1 declare variables
'2 clear old search results
'3 find records that match cell c1 from account dashboard sheet
If Target.Cells.Count > 1 Then Exit Sub
Application.EnableEvents = False
If Not Intersect(Target, Range("c:c")) Is Nothing Then
Dim sh1 As Worksheet, sh2 As Worksheet, rw As Long
Set sh1 = Sheets("Account_Dashboard")
Set sh2 = Sheets("Survey Data Lookup")
Name = Sheets("account_dashboard").Range("c1").Value
If Target.Value = Name Then
rw = sh2.Cells.Find("*", , xlValues, xlPart, xlByRows, xlPrevious).Row + 1
With sh2
Set fn = sh2.Range("A:A").Find(Target.Offset(, -74).Value, , xlValues, xlWhole)
If Not fn Is Nothing Then
.Cells(rw, 2) = sh1.Range("l" & Target.Row).Value 'account email
.Cells(rw, 3) = sh1.Range("r" & Target.Row).Value 'role in company
.Cells(rw, 4) = sh1.Range("cs" & Target.Row).Value 'survey type
.Cells(rw, 5) = sh1.Range("CB" & Target.Row).Value 'division
.Cells(rw, 6) = sh1.Range("cc" & Target.Row).Value 'sub-division
.Cells(rw, 7) = sh1.Range("cl" & Target.Row).Value 'wrk contact name
.Cells(rw, 8) = sh1.Range("A" & Target.Row).Value 'survey date
End With
End If
End If
Application.EnableEvents = True
End Sub
Thank you in advance for the help.
Bookmarks