Simple Macro Question

RWinfield

New Member
Joined
Feb 16, 2002
Messages
33
I have a worksheet with a column D "Quantity" and a column E "Level", both of which are named ranges. The formula I am using in column F is quite simple =IF(quantity<level,"X","")

This works on the worksheet, but I don't want it to recalculate every time a value is changed.

What I have been trying to do (unsucessfully) for the last hour or two is to incorporate this formula into a macro that can be called from a button on a userform. I would like to remove the formulas from column F and just have the procedure run when the button on the userform is clicked. Ideally, I would like to be able to select the last cell with information in it from column D and use that as the end of the loop. This seems to be simple but I just can't figure out how to do this.
Any help would be appreciated.:)
This message was edited by RWinfield on 2002-04-21 13:37
This message was edited by RWinfield on 2002-04-21 13:37
This message was edited by RWinfield on 2002-04-21 13:38
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
well for some reason I cannot seem to get the entire formula into the message. Obviously not my day.
Lets try this: if quantity < level "X" else ""
 
Upvote 0
Try a macro like this:

Sub FormYouLah()
'Insert formula in column F, dynamic range dependent on column E
Range("F1", Range("E65536").End(xlUp).Offset(, 1)).Formula = "=IF(RC[-2]<RC[-1],""X"",""No"")"
'Replace the formulas in F with values, so they don't recalculate:
Range("F1", Range("F65536").End(xlUp)).Value = Range("F1", Range("F65536").End(xlUp)).Value
End Sub

Modify the No condition result for whatever you meant by "else" in your question.
 
Upvote 0
Thanks Tom, that was what I needed. The only modification I made was to replace "NO" with "" as in the original question, to enter (or not enter depending on how you look at it) a null value to the other cells. The purpose in that was to expand the macro to select all rows with an "X" in them and copy them to another sheet. Thanks again for your help :)

Rick
 
Upvote 0

Forum statistics

Threads
1,213,504
Messages
6,114,016
Members
448,543
Latest member
MartinLarkin

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