Good day everyone,
I was fortunate to have some help on building this code and now I am trying to figure out why a new code is not working.
I have the following code in a macro
Private Sub CommandButton1_Click()
Dim ws1 As Worksheet: Set ws1 = Sheets("Sheet1")
Dim ws2 As Worksheet: Set ws2 = Sheets("Clients Contact")
Dim lr2 As Long
Dim iFind As Range
Application.ScreenUpdating = False
lr2 = ws2.Range("A" & Rows.Count).End(xlUp).Row
Set iFind = ws2.Range("A5:A" & lr2).Find(What:=TextBox1.Value, LookIn:=xlValues, Lookat:=xlPart, MatchCase:=False)
If Not iFind Is Nothing Then
iFind.Resize(1, 6).Copy
ws1.Range("C3").PasteSpecial xlPasteAll, Transpose:=True
Else
MsgBox ("That name cannot be found.")
End If
Application.CutCopyMode = False
Range("A1").Select
End Sub
This is searching in my Column A (Sheet2) starting at A5 then when finding the information it copies itself to my sheet1 in C3.
I need a Cmd button3 to search for the information in Column “B5: B” and when it gets this info, to copy the matching row (A to F) the same way it is doing for my previous code, in C3 while transposing the info.
What do I need to change to make this happend?
Bookmarks