Knockoutpie
Board Regular
- Joined
- Sep 10, 2018
- Messages
- 116
- Office Version
- 365
- Platform
- Windows
This code searches for a column with "CPN" moves down two cells, copies the data, searches the selected data in another sheet, offsets to a defined sell, copies that data and returns to the original sheet.
My issue is, the row I am pasting the data into will sometimes change.. is there a way to have the user select the row that we are pasting into?
At the bottom of the code, you can see where I have offset 6 columns to the right to paste. I want the user to be able to select "Z" or something like that for example.
My issue is, the row I am pasting the data into will sometimes change.. is there a way to have the user select the row that we are pasting into?
At the bottom of the code, you can see where I have offset 6 columns to the right to paste. I want the user to be able to select "Z" or something like that for example.
VBA Code:
'Find CPN
Cells.Find(What:="CPN").Offset(2, 0).Select
'Copy/search
Dim str1 As String
Dim Cntr As Integer
Cntr = 0
Do While Cntr <= 650
Cntr = Cntr + 1
str1 = ActiveCell.Value
Selection.Copy
Worksheets("Export").Activate
ActiveCell.Select
Cells.Find(What:=str1, After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext, MatchCase:=False, SearchFormat:=False).Activate
Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Offset(0, 15).Range("A1").Select
Selection.Copy
Worksheets("Quote").Activate
' Now find Part number and paste into price column
ActiveCell.Offset(0, 6).Select
Selection.PasteSpecial Paste:=xlPasteValues
Loop