Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Code Problem

Hi All,

I am creating a basic userform that enables a user to input currency
values in a cell.
Basically the form has buttons for the numbers 0-9 and also for
"." (decimal point)

I have got the following code for the decimal point, however when the
button is clicked, nothing happens.

Private Sub CommandButtonDP_Click()
ActiveCell.Value = ActiveCell.Value & "."
End Sub

On the number buttons I have got the same code, just with the relavent
number rather than "." and they work fine.

Could anybody please tell me why this is happening?

Many thanks,
Mark

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Code Problem

This is a case of Excel trying to be helpful and assuming that you do not
really want a nonsensical number of 12.< , "correcting" it to 12<.
Using a cell, you will need to format it as Text for this approach to work.
This may have repercussions on your other cells though, that you may have to
allow for.
Maybe use a TextBox instead, which already deals in...er text.

NickHK

"MarkHear1" wrote in message
ps.com...
Hi All,

I am creating a basic userform that enables a user to input currency
values in a cell.
Basically the form has buttons for the numbers 0-9 and also for
"." (decimal point)

I have got the following code for the decimal point, however when the
button is clicked, nothing happens.

Private Sub CommandButtonDP_Click()
ActiveCell.Value = ActiveCell.Value & "."
End Sub

On the number buttons I have got the same code, just with the relavent
number rather than "." and they work fine.

Could anybody please tell me why this is happening?

Many thanks,
Mark



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Code Problem


NickHK wrote:
This is a case of Excel trying to be helpful and assuming that you do not
really want a nonsensical number of 12.< , "correcting" it to 12<.
Using a cell, you will need to format it as Text for this approach to work.
This may have repercussions on your other cells though, that you may have to
allow for.
Maybe use a TextBox instead, which already deals in...er text.

NickHK

"MarkHear1" wrote in message
ps.com...
Hi All,

I am creating a basic userform that enables a user to input currency
values in a cell.
Basically the form has buttons for the numbers 0-9 and also for
"." (decimal point)

I have got the following code for the decimal point, however when the
button is clicked, nothing happens.

Private Sub CommandButtonDP_Click()
ActiveCell.Value = ActiveCell.Value & "."
End Sub

On the number buttons I have got the same code, just with the relavent
number rather than "." and they work fine.

Could anybody please tell me why this is happening?

Many thanks,
Mark


Thank you nick,

I have now put it into the macro to change the cell format to text
when the form is used and then back to currency when the form is
closed, however it doesn't change the cell back to currency. I have to
begin to edit the cell then change the selected cell and this changes
the format. Do you know how I can change this?

Thank you,
Mark

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
Problem with code kk Excel Discussion (Misc queries) 0 March 15th 08 03:01 PM
Problem with code jln via OfficeKB.com Excel Programming 2 November 9th 06 01:40 PM
Help with code problem Les Stout[_2_] Excel Programming 0 October 17th 06 10:01 AM
Problem with Code Below Ben H Excel Programming 7 February 25th 05 08:30 PM
Problem with code Steve[_71_] Excel Programming 2 December 12th 04 03:47 PM


All times are GMT +1. The time now is 05:38 PM.

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"