|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How to search with column heading then doing the lookup action for below code
Below mentioned code will insert new column called ISR/CSSM Mapped based on column D and from D2 values. But i dont want to mention the D and D2 insted i want mention column heading then seach for lookup value. Can any one help me?
Sub InsertColumn() Dim lLastRow As Long Dim oWorksheet As Worksheet Dim oLookupSheet As Worksheet Dim rEmailRange As Range Dim vCell As Variant Dim lRowCount As Long lRowCount = 2 Set oWorksheet = Worksheets("AP_Quotes_20140928-020000") Set oLookupSheet = Worksheets("ISR CSSMs") On Error Resume Next oWorksheet.Range("E:E").Insert oWorksheet.Cells(1, 5).Value = "ISR/CSSM Mapped" lLastRow = oWorksheet.Cells(Rows.Count, 4).End(xlUp).Row Set rEmailRange = oWorksheet.Range("d2:d" & lLastRow) For Each vCell In rEmailRange oWorksheet.Cells(lRowCount, 5).Value = Application.WorksheetFunction.VLookup(vCell.Value, oLookupSheet.Range("B2:C719"), 2, 0) lRowCount = lRowCount + 1 Next vCell End Sub |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Need code to Parse and arrange data based on heading | winmaxservices2 | Excel Programming | 1 | 01-01-2015 01:04 AM |
VBA to search each row of a word table column | Marrick13 | Word VBA | 7 | 11-17-2014 04:33 AM |
How to line up a merged field to a column heading | j_Southern | Mail Merge | 2 | 10-08-2012 12:28 PM |
How to link an action on one slide on a powerpoint with the same action on another | slevinmj | PowerPoint | 0 | 02-24-2011 05:38 AM |
Need to search a column for a macth and return a result from a third column | pdfaust | Excel | 2 | 02-03-2011 03:02 PM |