Code to Resize cells with formula in the first cell

RAJESH1960

Banned for repeated rules violations
Joined
Mar 26, 2020
Messages
2,313
Office Version
  1. 2019
Platform
  1. Windows
Hello experts

I have this data in my sheet where column E is derived from a code. There is a formula in cell F7 which is dragged down to 3000 rows.

The formula is =VLOOKUP(E6,$A$2:$A$3000,1,0). If the cell in column E19 is blank, then I want the cell F19 to be blank. I tried this formula =IFERROR(VLOOKUP(E6,$A$2:$A$3000,1,0),"")

The problem is when the next line of code selects the cells with an error, it selects all the cells with error, even the cells which are blank in column E. Is it possible to write a code to insert the formula in cell F6 and resize the cells with the cells with value in the column E.?
Book1
ABCDEFG
1
2January
3February
4March
5April
6MayMercury#N/A
7JuneFebruaryFebruary
8JulyMarchMarch
9AugustAprilApril
10SeptemberMayMay
11OctoberJuneJune
12NovemberJulyJuly
13DecemberAugustAugust
14SundaySeptemberSeptember
15MondayOctoberOctober
16TuesdayNovemberNovember
17WednesdayDecemberDecember
18SundaySunday
19#N/A
20#N/A
21#N/A
22#N/A
23#N/A
24#N/A
25#N/A
List of Ledgers
Cell Formulas
RangeFormula
F6:F25F6=VLOOKUP(E6,$A$2:$A$4922,1,0)
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,214,907
Messages
6,122,185
Members
449,071
Latest member
cdnMech

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