Macro to change VLookup Range

RahulNa

Board Regular
Joined
Jul 12, 2012
Messages
127
Office Version
  1. 365
Platform
  1. Windows
Hi Guys,

I want to update Vlookup range in the report with respect to sheet name in cell A27.

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][TABLE="width: 176"]
<tbody>[TR]
[TD]Business Solution[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]Connect Status[/TD]
[/TR]
[TR]
[TD][TABLE="width: 176"]
<tbody>[TR]
[TD]Business Retail[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]=VLOOKUP($B$11,Oct!C:J,4,0)[/TD]
[/TR]
[TR]
[TD][TABLE="width: 176"]
<tbody>[TR]
[TD]Business Digital[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]=VLOOKUP($B$11,Oct!C:J,6,0)[/TD]
[/TR]
[TR]
[TD][TABLE="width: 176"]
<tbody>[TR]
[TD]Business Corporate[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]=VLOOKUP($B$11,Oct!C:J,7,0)[/TD]
[/TR]
[TR]
[TD][TABLE="width: 176"]
<tbody>[TR]
[TD]Technology Retail[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]=VLOOKUP($B$11,Oct!C:J,8,0)[/TD]
[/TR]
[TR]
[TD][TABLE="width: 176"]
<tbody>[TR]
[TD]Technology Corporate[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]=VLOOKUP($B$11,Oct!C:J,9,0)[/TD]
[/TR]
</tbody>[/TABLE]

For eg:- Cell A27 have drop down with Aug,Sep,Oct. So if I select Sep then the whole range should change as


[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][TABLE="width: 176"]
<tbody>[TR]
[TD]Business Solution[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]Connect Status[/TD]
[/TR]
[TR]
[TD][TABLE="width: 176"]
<tbody>[TR]
[TD]Business Retail[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]=VLOOKUP($B$11,Sep!C:J,4,0)[/TD]
[/TR]
[TR]
[TD][TABLE="width: 176"]
<tbody>[TR]
[TD]Business Digital[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]=VLOOKUP($B$11,Sep!C:J,6,0)[/TD]
[/TR]
[TR]
[TD][TABLE="width: 176"]
<tbody>[TR]
[TD]Business Corporate[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]=VLOOKUP($B$11,Sep!C:J,7,0)[/TD]
[/TR]
[TR]
[TD][TABLE="width: 176"]
<tbody>[TR]
[TD]Technology Retail[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]=VLOOKUP($B$11,Sep!C:J,8,0)[/TD]
[/TR]
[TR]
[TD][TABLE="width: 176"]
<tbody>[TR]
[TD]Technology Corporate[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]=VLOOKUP($B$11,Sep!C:J,9,0)

[/TD]
[/TR]
</tbody>[/TABLE]

****** id="cke_pastebin" style="position: absolute; top: 281px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][TABLE="width: 176"]
<tbody>[TR]
[TD]Business Solution[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]Connect Status[/TD]
[/TR]
[TR]
[TD][TABLE="width: 176"]
<tbody>[TR]
[TD]Business Retail[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]=VLOOKUP($B$11,Oct!C:J,4,0)[/TD]
[/TR]
[TR]
[TD][TABLE="width: 176"]
<tbody>[TR]
[TD]Business Digital[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]=VLOOKUP($B$11,Oct!C:J,6,0)[/TD]
[/TR]
[TR]
[TD][TABLE="width: 176"]
<tbody>[TR]
[TD]Business Corporate[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]=VLOOKUP($B$11,Oct!C:J,7,0)[/TD]
[/TR]
[TR]
[TD][TABLE="width: 176"]
<tbody>[TR]
[TD]Technology Retail[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]=VLOOKUP($B$11,Oct!C:J,8,0)[/TD]
[/TR]
[TR]
[TD][TABLE="width: 176"]
<tbody>[TR]
[TD]Technology Corporate[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD]=VLOOKUP($B$11,Oct!C:J,9,0)

[/TD]
[/TR]
</tbody>[/TABLE]
</body>
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,223,276
Messages
6,171,140
Members
452,381
Latest member
Nova88

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