Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
This macro should do what you want. I assumed the following:
Your data starts in row 2 in Column A of the first sheet. The copied data goes into Column G of the first sheet. The second sheet is named "Second". The code searches for the values in Column A of the first sheet. The code searches IN Column A of the second sheet. If found, the value in Column G of the second sheet is copied and pasted to the first sheet. HTH Otto Sub CopyData() Dim RngColAFirst As Range Dim RngColASecond As Range Dim i As Range Set RngColAFirst = _ Range("A2", Range("A" & Rows.Count).End(xlUp)) With Sheets("Second") Set RngColASecond = _ .Range("A2", .Range("A" & Rows.Count).End(xlUp)) For Each i In RngColAFirst If Not RngColASecond.Find(What:=i.Value, _ LookAt:=xlWhole) Is Nothing Then RngColASecond.Find(What:=i.Value, _ LookAt:=xlWhole).Offset(, 6).Copy _ i.Offset(, 6) End If Next i End With End Sub "Mr. Clean" wrote in message ... I'd like to start at the first row and step through each row of the first sheet. The worksheet has 300 rows, so I'd like to automate the process. The value should be at the end of the row selected. "Otto Moehrbach" wrote: How is the first cell selected? For instance, does the user select a cell and then run the macro? Where in the first sheet do you want the value placed that came from the second sheet? HTH Otto "Mr. Clean" <Mr. wrote in message ... I need to write a VBA program (or a macro) that will select a cell from a worksheet, then look for the same text in a cell in another worksheet (in the same workbook), then copy another cell in the row that the text is found, then paste it in the first worksheet. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Stop excel from dropping the 0 in the beginning of a number? | Setting up and Configuration of Excel | |||
Open Excel 2003 from Windows Explorer | Excel Discussion (Misc queries) | |||
Need suggestions for some uses of Ms Excel | Excel Discussion (Misc queries) | |||
Excel Range Value issue (Excel 97 Vs Excel 2003) | Excel Discussion (Misc queries) | |||
Excel 2002 and 2000 co-install. Control Which Starts ? | Excel Discussion (Misc queries) |