modify a vba code

BORUCH

Well-known Member
Joined
Mar 1, 2016
Messages
537
Office Version
  1. 365
Platform
  1. Windows
Code:
Sub changetoacertainpercentage()


Application.Run ("SelectBold")
Dim cell As Range, askedchange As Double, answer As String, answer1 As String
If ActiveCell.NumberFormat <> "_($* #,##0.00_);_($* (#,##0.00);_($* ""-""??_);_(@_)" And ActiveCell.NumberFormat <> "$#,##0.00" And ActiveCell.NumberFormat <> "$#,##0.00_);[Red]($#,##0.00)" Then Exit Sub


answer = InputBox("What percentage you want to increase?")
answer1 = InputBox("What Penny Amount Do You Want It Rounded? ")
askedchange = 0.01 * Val(answer)


For Each cell In Selection
 
  If answer1 <> "" And cell.Value <> "" And IsNumeric(cell.Value) Then cell.Value = Application.MRound(cell.Value * (1 + askedchange), answer1)


If answer1 = "" And cell.Value <> "" And IsNumeric(cell.Value) Then cell.Value = cell.Value * (1 + askedchange)
Next cell
End Sub

Hi

i need help with modifying this vba code

I have in a cell that is formatted as currency a value, with text inside.
How can i have this code find only the numbers in that particular cell and change them accordingly for ex. in one cell i could have

$17.75 BX
$106.50 CS
(merge and center & wrap text)
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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