Assign Module to a column

WxShady13

Board Regular
Joined
Jul 24, 2018
Messages
185
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
I have a formula in a Module that I want to assign to Column H. This formula determines if the training date is past Today() and will either display Not Qualified or Fully Qualified. Column H is dynamic based on the amount of training required for the job selected. I currently have it housed in a module, would it be easier to assign it within the pasted module, or on its own?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I can't say I am exactly sure what you are asking.
Can you post your VBA code?
 
Upvote 0
Update to name...insert formula to a column (NOT USING A MODULE)...Below is the code that inserts the IF formula for column H on a worksheet. I need to get that formula to copy down for each row, however the rows vary on each worksheet.


lastrow = range("H" & Rows.Count).End(xlUp).Row
range("H3:H" & lastRow)"=If(G1=""N/A"",""Not Qualified"",If(G1<Today(),""Not Qualifed"",""Fully Qualified""))"
 
Upvote 0
It looks like your formula is getting cut-off. See here for why: https://www.mrexcel.com/forum/about-board/680917-formulas-not-appearing-completely-read.html

I think what may be confusing is your use/understanding of the Excel lingo. A MODULE is simply a container for VBA code. VBA code can either be in the form of Procedures or Functions. You cannot have VBA code without a Module. So I am not sure what you mean by "NOT USING A MODULE"...

In determining your "lastrow" calculation, you need to use a column that has data in it. It looks like that you are trying to use column H, which also appears to be the same column that you are placing the formula in. That probably does not make sense. If column H is empty, that is not the column that you want to use to try to find where the last row with data is. I see that your formula references column G. Maybe that is the column you should be using in your "lastrow" calculation.

You can assign the formula to the whole range at once using relative reference (R1C1) formula notation. This is easier to get than you think. Simply turn on your Macro Recorder, and then manually enter the formula in any cell in column H, then stop the Macro Recorder. If you then review your recorded code, you will see/have the VBA code for assigning the formula that you need to put in the code you are building.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

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