Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Macro prompts for a number to be used in this macro as a variable

Dear All,
could anyone help me to write a part of a macro which will prompt to
input a number. This number will be used in the same macro as a number
variable to specify a condition. I mean a user will be prompted to input the
lowest invoice value. This value can be for example 540.50. This figure
should be used later in the same macro as condition to delete rows having a
smaller value in an appropriate cell. I need a help to write the part of the
macro promting for the input and to assign the input figuer to a variable.
Thank you very much for your help.
Drahos.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Macro prompts for a number to be used in this macro as a variable

sub GetANumber
MyNumber=val(inputbox("Please enter a number"))
'HOWEVER, user can type anything they like into an input box
'A UserForm would be a better solution OR a cell on the workbook, as
both
'could be restricted to numeric input only
end sub

Drahos wrote:
Dear All,
could anyone help me to write a part of a macro which will prompt to
input a number. This number will be used in the same macro as a number
variable to specify a condition. I mean a user will be prompted to input the
lowest invoice value. This value can be for example 540.50. This figure
should be used later in the same macro as condition to delete rows having a
smaller value in an appropriate cell. I need a help to write the part of the
macro promting for the input and to assign the input figuer to a variable.
Thank you very much for your help.
Drahos.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Macro prompts for a number to be used in this macro as a variable


myNum = Application.InputBox("Input number",Type:=1)
If myNum = 0 then exit Sub

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Drahos" wrote in message
...
Dear All,
could anyone help me to write a part of a macro which will prompt to
input a number. This number will be used in the same macro as a number
variable to specify a condition. I mean a user will be prompted to input

the
lowest invoice value. This value can be for example 540.50. This figure
should be used later in the same macro as condition to delete rows having

a
smaller value in an appropriate cell. I need a help to write the part of

the
macro promting for the input and to assign the input figuer to a variable.
Thank you very much for your help.
Drahos.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Macro prompts for a number to be used in this macro as a variable

Thanks Ardus and Bob for correcting my information - I had not come
across application.inputbox before - I will remember this in future as
it's kinda useful!!! You never stop learning!

Bob Phillips wrote:
myNum = Application.InputBox("Input number",Type:=1)
If myNum = 0 then exit Sub

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Drahos" wrote in message
...
Dear All,
could anyone help me to write a part of a macro which will prompt to
input a number. This number will be used in the same macro as a number
variable to specify a condition. I mean a user will be prompted to input

the
lowest invoice value. This value can be for example 540.50. This figure
should be used later in the same macro as condition to delete rows having

a
smaller value in an appropriate cell. I need a help to write the part of

the
macro promting for the input and to assign the input figuer to a variable.
Thank you very much for your help.
Drahos.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Macro prompts for a number to be used in this macro as a variable

It's most useful with Type:=8, that allows the user to select a range from
the worksheet.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
oups.com...
Thanks Ardus and Bob for correcting my information - I had not come
across application.inputbox before - I will remember this in future as
it's kinda useful!!! You never stop learning!

Bob Phillips wrote:
myNum = Application.InputBox("Input number",Type:=1)
If myNum = 0 then exit Sub

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Drahos" wrote in message
...
Dear All,
could anyone help me to write a part of a macro which will prompt

to
input a number. This number will be used in the same macro as a number
variable to specify a condition. I mean a user will be prompted to

input
the
lowest invoice value. This value can be for example 540.50. This

figure
should be used later in the same macro as condition to delete rows

having
a
smaller value in an appropriate cell. I need a help to write the part

of
the
macro promting for the input and to assign the input figuer to a

variable.
Thank you very much for your help.
Drahos.




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Macro prompts for a number to be used in this macro as a varia

Dear Bob and Aidan,

the advice is fine. It works. Thanks a lot.
Drahos

"Bob Phillips" wrote:


myNum = Application.InputBox("Input number",Type:=1)
If myNum = 0 then exit Sub

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Drahos" wrote in message
...
Dear All,
could anyone help me to write a part of a macro which will prompt to
input a number. This number will be used in the same macro as a number
variable to specify a condition. I mean a user will be prompted to input

the
lowest invoice value. This value can be for example 540.50. This figure
should be used later in the same macro as condition to delete rows having

a
smaller value in an appropriate cell. I need a help to write the part of

the
macro promting for the input and to assign the input figuer to a variable.
Thank you very much for your help.
Drahos.




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 - Formula RC[?] with ? being a variable number steven.holloway Excel Discussion (Misc queries) 5 July 18th 08 10:07 AM
Macro prompts user to run macro? miwarren[_7_] Excel Programming 5 October 20th 05 02:43 PM
How can I suppress prompts during macro run? Andorv Excel Discussion (Misc queries) 2 October 19th 05 12:37 PM
Getting rid of Prompts in a macro Duncan J Excel Programming 5 February 12th 04 07:46 AM
Use row number in spreadsheet as variable in macro captbluefin Excel Programming 1 October 10th 03 03:49 PM


All times are GMT +1. The time now is 08:56 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"