ActiveCell.Formula

MrCrow

New Member
Joined
Aug 25, 2017
Messages
3
Context: I work inventory at a rebar fab company. I have this report that uses a userform to make tables that show the loads the mill has ready to be picked up. Then this compares these to what we have ordered for the specific cycle (to make sure we get everything we ordered). Now I am trying to have it show what loads are left to be picked up at the mill, so I can convert that data into tons and factor it into our inventory.

The roadblock I am running into is with this equation.
Code:
ActiveCell.Formula = "=COUNTIF(" & RemAtMill.Address & "," <> "&"")"


When the userform creates the specific table, there is a "Date" cell next to each pickup number. When a load is picked up I put the date it was received. RemAtMill is the range of these date cells. All I am trying to do here is get the count of each cell in this range that is not blank. But whenever I run the userform and everything is said and done, instead of inserting this formula into the proper cell, I get the text "True". and for the life of me I cant figure out why I get "true" instead of a formula. I am not that experienced in VBA but I have tried a couple of different things and get the same result
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hi & welcome to the board
Try
Code:
Range("B2").Formula = "=COUNTIF(RemAtMill,""<>"""""")"
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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