DavidExcel
New Member
- Joined
- Feb 12, 2019
- Messages
- 10
In my code, I use Evaluate to create an If statement as I would in Excel.
It seems to behave as it should except I can't seem to return an empty string (""). I have to say that this range 'NewDiscountPLColumn' where results go is formatted as %.
I have tried to put a random value, and it does return it when the first column is empty, so I would think it is working.
Now, if I put 'Blank', 'vbNullString', or even a reference to an empty cell in Excel, it always seem to return 0%.
I have even tried to replace the value after the evaluate calculation, and no luck.
Below is my code:
ANy ideas?
Thanks in advance.
It seems to behave as it should except I can't seem to return an empty string (""). I have to say that this range 'NewDiscountPLColumn' where results go is formatted as %.
I have tried to put a random value, and it does return it when the first column is empty, so I would think it is working.
Now, if I put 'Blank', 'vbNullString', or even a reference to an empty cell in Excel, it always seem to return 0%.
I have even tried to replace the value after the evaluate calculation, and no luck.
Below is my code:
Code:
Dim NewDiscountPL As Variant
NewDiscountPL = InputBox("Enter the new discount to apply (without % sign) to all Product Lines")
Dim ProductLinesColumn As Range
Set ProductLinesColumn = Range("F42:F91")
Dim NewDiscountPLColumn As Range
Set NewDiscountPLColumn = Range("H42:H91")
NewDiscountPLColumn = Evaluate("If(IsBlank(" & ProductLinesColumn.Address & ")," & [I][B]Blank[/B][/I] & "," & NewDiscountPL & "/ 100)")
ANy ideas?
Thanks in advance.