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.
i=application.inputbox("Prompt","Title",type:=1)
type:=1 requests a numerical value.
HTH
--
AP
"Drahos" <Drahos@discussions.microsoft.com> a écrit dans le message de news:
DB253203-2E96-4F35-9681-7F8D15B25844@microsoft.com...
> 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.
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.
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" <Drahos@discussions.microsoft.com> wrote in message
news:DB253203-2E96-4F35-9681-7F8D15B25844@microsoft.com...
> 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.
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" <Drahos@discussions.microsoft.com> wrote in message
> news:DB253203-2E96-4F35-9681-7F8D15B25844@microsoft.com...
> > 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.
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)
<aidan.heritage@virgin.net> wrote in message
news:1149064298.779619.265790@j55g2000cwa.googlegroups.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" <Drahos@discussions.microsoft.com> wrote in message
> > news:DB253203-2E96-4F35-9681-7F8D15B25844@microsoft.com...
> > > 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.
>
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" <Drahos@discussions.microsoft.com> wrote in message
> news:DB253203-2E96-4F35-9681-7F8D15B25844@microsoft.com...
> > 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.
>
>
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks