VBA to read values in parentheses as positve

ThomasOES

Board Regular
Joined
Aug 29, 2017
Messages
174
I need vba code to read values in parentheses as positive

An if statement would be perfect.

Sort of

If (3) Then 3.

Thanks

Tom
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
I need vba code to read values in parentheses as positive

An if statement would be perfect.

Sort of

If (3) Then 3.
That is kind of a general question with no specifics, so the best we can do is give you a general answer that may or may not be the most efficient way to handle your actual data. With that said, try using the Abs function... it returns a positive value whether its argument is positive or negative.
 
Upvote 0
Ok

I've pasted some of the code that leads up to the need for the number in the parentheses to remain as listed in the parentheses.

Selection.End(xlDown).Activate
Set Rng = ActiveCell
Rng.Name = "MonVal"

Sheets(Range("elcell").Value).Activate
Range("S2").Select

ActiveCell.FormulaR1C1 = "=MonVal/R19C28*RC[-5]/(1+R20C28*RC[-17]/R19C28)"
ActiveCell.Copy

As you can see the cell at the bottom of a column of data is named "MonVal"
"MonVal" is used in a formula
I need a previous step to make certain that if "MonVal" has parentheses it is read as listed, not changed to negative. Even taking away the parentheses is okay.

Thanks
Tom
 
Last edited:
Upvote 0
I've pasted some of the code that leads up to the need for the number in the parentheses to remain as listed in the parentheses.

Selection.End(xlDown).Activate
Set Rng = ActiveCell
Rng.Name = "MonVal"

Sheets(Range("elcell").Value).Activate
Range("S2").Select

ActiveCell.FormulaR1C1 = "=ABS(MonVal)/R19C28*RC[-5]/(1+R20C28*RC[-17]/R19C28)"
ActiveCell.Copy

As you can see the cell at the bottom of a column of data is named "MonVal"
"MonVal" is used in a formula
I need a previous step to make certain that if "MonVal" has parentheses it is read as listed, not changed to negative. Even taking away the parentheses is okay.
Try adding what I show in red above
 
Last edited:
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