View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mark Mark is offline
external usenet poster
 
Posts: 989
Default Code to mimic vlookup

I am trying to create a macro that will do the following.

1). Look in a column on a one worksheet, going row by row, for a specified
text value.
2). If the value is found, then the value in the column to the left should
be copied.
3). The copied value should be pasted in a seperate worksheet in a specified
column.
4). The process should repeat until all matches in the first sheet have been
found, copied, and pasted in separate rows on the second worksheet.

The following is my ineffective code, at present. Any help is appreciated!

Sub Business_Populate()

Dim j As Long
Dim k As Long

With Application
.Calculation = xlCalculationManual
.ScreenUpdating = False


Sheets("Setup Form").Select
Range("d4:d33").Select
For j = Selection.Cells.Count To 1 Step -1
If Selection.Cells(j) = "Business" Then
Selection.Cells(j, "d").Offset(0, -3).Copy

End If
Next j

Sheets("Project Completion Costs").Select
Range("e10,e43").Select
For k = Selection.Cells.Count To 34 Step 1
If Cells(k, "e") = "" Then
Cells(k, "e").Select
ActiveSheet.Paste


End If
Next k

End With
End Sub