VBA Help - Keep Format of Referenced Cells When Using "IF" Formula

CtrlAltRage

New Member
Joined
Aug 23, 2022
Messages
12
Office Version
  1. 365
Platform
  1. Windows
Hey all,

I've scoured the forums and I cannot seem to find an answer to what I'm looking for.

Right now, I have a workbook that contains multiple sheets. The first sheet has a drop down menu where you select a specific option. Then in the cell next to it, I have an IF formula that will populate several referenced cells from another sheet in the workbook.

The formula I'm using for this is:

(In cell D2)
Excel Formula:
=IF('Automated Comparison'!B2="Basic",'Basic (For Reference)'!A2:G11,IF('Automated Comparison'!B2="Pro",'Pro (For Reference)'!A2:G12,IF(B2="Premium",'Premium (For Reference'!A2:G14,IF(B2="Enterprise",'Enterprise (For Reference)'!A2:G17))))

This formula then auto populates the referenced cells into the sheet (7 columns of reference data).

That part works great - but the problem is keeping the formatting of the referenced cells.

I've seen a few examples that are supposed to preserve the formatting when referencing cells, but I cannot seem to figure it out. I'm very new to VBA in excel.

Any help would be great, I appreciate it!
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,214,944
Messages
6,122,384
Members
449,080
Latest member
Armadillos

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