Vba question

Giggzz

Well-known Member
Joined
Jul 4, 2002
Messages
990
If r.Value > 0 Then r.Value = r.Value - (r.Value * Len(Right(UserForm6.TextBox1.Value) - 1))

in the above code Im trying to remove the % in the the textbox to get the proper result. Getting the error argument not optional and the right is highlighted.
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
40,436
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
Code:
If r.Value > 0 Then r.Value = r.Value - (r.Value * Right(UserForm6.TextBox1.Value, Len(UserForm6.TextBox1.Value) - 1))
or if this code is in userform6:
Code:
If r.Value > 0 Then r.Value = r.Value - (r.Value * Right(Me.TextBox1.Value, Len(Me.TextBox1.Value) - 1))
 
Upvote 0

Giggzz

Well-known Member
Joined
Jul 4, 2002
Messages
990
Thank you,

Code:
Private Sub totalTextBoxes()
Dim RunningSum As Single
RunningSum = 0
With UserForm6
    Do While .TextBox2.Value = ""
       UserForm6.Show
    Loop
    .TextBox4.Text = Val(.TextBox2.Value) - Val(.TextBox3.Value)
    .[B]TextBox5.Text = Val(.TextBox2.Value) / Val(.TextBox3.Value[/B])
    
End With
End Sub

Trying to add a format in textbox5 to show the percent as 65.27 instead of .672745611??
 
Upvote 0

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
40,436
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
  2. MacOS
Code:
.TextBox5.Text = Format(Val(.TextBox2.Value) / Val(.TextBox3.Value), "0%")
 
Upvote 0

Forum statistics

Threads
1,191,697
Messages
5,988,163
Members
440,131
Latest member
EricMoz

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
Top