VBA code to lookup and fill across

ramananhrm

Board Regular
Joined
Apr 19, 2011
Messages
156
Hi,

Im trying to write a VBA code for lookup few words in a range of cells.

There was no success and end up in recording macro and below mentioned is the code (Using record Macro)

Sub normallookupstyle()


Selection.FormulaR1C1 = "=VLOOKUP(RC[-1],{123;""23KC"";""Animal"";""Planet"";""Split"";""Layout""},1,0)"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False


End Sub

I have mentioned the un-successful code below (As im not good in VBA coding)

Sub codingstylelookup()
Dim lookrange() As Variant


lookrange(123,""23KC"",""Animal"",""Planet"",""Split"",""Layout"")


ActiveCell.Value = Application.WorksheetFunction.VLookup(ActiveCell(0, -1).Value, lookrange, 1, 0)


End Sub


Please help me out with a correct VBA code for the code i have highlighted in red color

I would like to fill across the range between B2 to B18 (File attached)


https://app.box.com/s/4soit7o7ffxr45wbxl9rycukd08274s4

Excel Forum link:

http://www.excelforum.com/showthread.php?t=1129457&p=4331014#post4331014
 
Last edited:

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Forum statistics

Threads
1,216,027
Messages
6,128,366
Members
449,444
Latest member
abitrandom82

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top