Darkcloud617
New Member
- Joined
- Sep 7, 2017
- Messages
- 38
Hello,
Thank you in advance for any help you may provide. I have cobbled together a VBA code that seems to be working, I just cant get it to paste the copied data correctly.
VBA uses a search box for a user to enter data, it searches Column M for a match and if found it copies a range of cells from another part of the sheet (that all works correctly)... then it SHOULD paste the copied data in the row it found starting at column A. It needs to paste the copied data to the row from the match. There are a total of 9 cells it should paste (again, starting at column A).
I have been tinkering so much with this thing and I am at a loss. Even going back to the basics didnt work. Any help is greatly appreciated.
Thank you in advance for any help you may provide. I have cobbled together a VBA code that seems to be working, I just cant get it to paste the copied data correctly.
VBA uses a search box for a user to enter data, it searches Column M for a match and if found it copies a range of cells from another part of the sheet (that all works correctly)... then it SHOULD paste the copied data in the row it found starting at column A. It needs to paste the copied data to the row from the match. There are a total of 9 cells it should paste (again, starting at column A).
I have been tinkering so much with this thing and I am at a loss. Even going back to the basics didnt work. Any help is greatly appreciated.
Code:
Sub exception()
Dim FindString As String
Dim Rng As Range
FindString = InputBox("Enter a Date")
If Trim(FindString) <> "" Then
With Sheets("Sheet1").Range("M:M")
Set Rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Range("AO18:AW18").Select
Application.CutCopyMode = False
Selection.Copy
ActiveRow.Paste
Else
MsgBox "Nothing found"
End If
End With
End If
End Sub