Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro prompts for a number to be used in this macro as a variable
i=application.inputbox("Prompt","Title",type:=1)
type:=1 requests a numerical value. HTH -- AP "Drahos" a écrit dans le message de news: ... 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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro - Formula RC[?] with ? being a variable number | Excel Discussion (Misc queries) | |||
Macro prompts user to run macro? | Excel Programming | |||
How can I suppress prompts during macro run? | Excel Discussion (Misc queries) | |||
Getting rid of Prompts in a macro | Excel Programming | |||
Use row number in spreadsheet as variable in macro | Excel Programming |