Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default Inputbox to enter a %

I'm tring to use an Input Box to enter a percentage. I'm entering 7.8 but
the cell shows 780.00%

Here's what I have (that's applicable)
Dim ACR As String
ACR = InputBox("ACR?")
Range("G47").Select
ActiveCell.NumberFormat = "0.00%"
ActiveCell.Value = "" & ACR & ""

I've also tried
ActiveCell.Value = "" & ACR & "" * 0.01
and
ActiveCell.Value = "" & ACR & "" / 100
but I get a Type Mismatch
When I try to declare the variable as in Integer, I get a Type Mismatch as
soon as I enter 7.8

I know I could enter .078 and my problem would be solved, but I'll have
other folks running this too. It makes more sense to be able to enter 7.8
and get 7.8% or 7.80% displayed.

Please help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Inputbox to enter a %

Try this:

Dim ACR As String
ACR = InputBox("ACR?")
ACR = ACR * 0.01
Range("G47").Select
ActiveCell.NumberFormat = "0.00%"
ActiveCell.Value = "" & ACR & ""
ActiveCell.Value = ACR '<=== Why not this ?
End Sub

"StephanieH" wrote:

I'm tring to use an Input Box to enter a percentage. I'm entering 7.8 but
the cell shows 780.00%

Here's what I have (that's applicable)
Dim ACR As String
ACR = InputBox("ACR?")
Range("G47").Select
ActiveCell.NumberFormat = "0.00%"
ActiveCell.Value = "" & ACR & ""

I've also tried
ActiveCell.Value = "" & ACR & "" * 0.01
and
ActiveCell.Value = "" & ACR & "" / 100
but I get a Type Mismatch
When I try to declare the variable as in Integer, I get a Type Mismatch as
soon as I enter 7.8

I know I could enter .078 and my problem would be solved, but I'll have
other folks running this too. It makes more sense to be able to enter 7.8
and get 7.8% or 7.80% displayed.

Please help.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default Inputbox to enter a %

Thank you. It works perfectly.

You know, I have no idea why I haven't been entering my variables that way.
(Activecell.Value = ACR). I guess the first time I used a variable, this
was the way I saw it and it worked. Bad habit to get into.... Thanks for
the reminder.

"Toppers" wrote:

Try this:

Dim ACR As String
ACR = InputBox("ACR?")
ACR = ACR * 0.01
Range("G47").Select
ActiveCell.NumberFormat = "0.00%"
ActiveCell.Value = "" & ACR & ""
ActiveCell.Value = ACR '<=== Why not this ?
End Sub

"StephanieH" wrote:

I'm tring to use an Input Box to enter a percentage. I'm entering 7.8 but
the cell shows 780.00%

Here's what I have (that's applicable)
Dim ACR As String
ACR = InputBox("ACR?")
Range("G47").Select
ActiveCell.NumberFormat = "0.00%"
ActiveCell.Value = "" & ACR & ""

I've also tried
ActiveCell.Value = "" & ACR & "" * 0.01
and
ActiveCell.Value = "" & ACR & "" / 100
but I get a Type Mismatch
When I try to declare the variable as in Integer, I get a Type Mismatch as
soon as I enter 7.8

I know I could enter .078 and my problem would be solved, but I'll have
other folks running this too. It makes more sense to be able to enter 7.8
and get 7.8% or 7.80% displayed.

Please help.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to select cells in column enter data then press enter NP New Users to Excel 1 February 20th 08 04:21 PM
Enter multiple numbers in a cell so total shows when enter keypres newbie Excel Worksheet Functions 2 August 19th 07 12:23 PM
Enter info in one sheet, auto enter in another based on one field The BusyHighLighter[_2_] New Users to Excel 1 August 1st 07 10:54 PM
Inputbox and Application.InputBox Maria[_7_] Excel Programming 1 September 20th 04 11:36 AM
Inputbox to enter date Tom Ogilvy Excel Programming 0 July 27th 04 05:44 PM


All times are GMT +1. The time now is 05:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"