Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Please help a newbie to VB!!!


Hi all

Can anyone help me please?

I want to be able to run a macro in an excel spreadsheet that will
include a pop up msgbox that says "enter a value" and then a user can
put a value in and then i want it to put that value in Cell A1 (For
Example). This could be either a numeric number or a date field (eg
31/12/2006).
As I am a newbie to this I am struggling. The rest of the macro I have
done through recorder in excel, can anyone help me???

Many thanks for reading
Cheers and all the best
Mark
:) :)


--
certain_death
------------------------------------------------------------------------
certain_death's Profile: http://www.excelforum.com/member.php...o&userid=24561
View this thread: http://www.excelforum.com/showthread...hreadid=548915

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Please help a newbie to VB!!!


Try:

[a1] = Application.InputBox("Enter a value")

This will accept any value from an inputbox and place it in A1. To
force the inputbox to only accept a number:

[a1] = Application.InputBox("Enter a value", , , , , , , 1)

this will display an error message and return FALSE if the value isn't
a number.

The first example will display a valid date in the standard format, but
will also accept text values. The second will accept dates but convert
them into numbers (e.g. 06/06/2006 will be displayed as 38874, so you'd
have to tell your macro to format it accordingly)

Hope this helps
Col


--
colofnature
------------------------------------------------------------------------
colofnature's Profile: http://www.excelforum.com/member.php...o&userid=34356
View this thread: http://www.excelforum.com/showthread...hreadid=548915

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Please help a newbie to VB!!!

Sub GetValue()
Dim myVar as variant

myVar = InputBox("Enter a Value")

Range("A1").value = myVar

End Sub

Or skip the variable:

Sub GetValue()

Range("A1").Value = InputBox("Enter a Value")

End sub

--
Thanks,
Mike


"certain_death" wrote:


Hi all

Can anyone help me please?

I want to be able to run a macro in an excel spreadsheet that will
include a pop up msgbox that says "enter a value" and then a user can
put a value in and then i want it to put that value in Cell A1 (For
Example). This could be either a numeric number or a date field (eg
31/12/2006).
As I am a newbie to this I am struggling. The rest of the macro I have
done through recorder in excel, can anyone help me???

Many thanks for reading
Cheers and all the best
Mark
:) :)


--
certain_death
------------------------------------------------------------------------
certain_death's Profile: http://www.excelforum.com/member.php...o&userid=24561
View this thread: http://www.excelforum.com/showthread...hreadid=548915


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default Please help a newbie to VB!!!

Mark,

Have a go with this:

Sub InputValue()
Application.ActiveSheet.Range("A1").Value = InputBox("Enter a value")
End Sub

Best regards

John

"certain_death"
wrote in message
news:certain_death.28zb11_1149594303.9491@excelfor um-nospam.com...

Hi all

Can anyone help me please?

I want to be able to run a macro in an excel spreadsheet that will
include a pop up msgbox that says "enter a value" and then a user can
put a value in and then i want it to put that value in Cell A1 (For
Example). This could be either a numeric number or a date field (eg
31/12/2006).
As I am a newbie to this I am struggling. The rest of the macro I have
done through recorder in excel, can anyone help me???

Many thanks for reading
Cheers and all the best
Mark
:) :)


--
certain_death
------------------------------------------------------------------------
certain_death's Profile:
http://www.excelforum.com/member.php...o&userid=24561
View this thread: http://www.excelforum.com/showthread...hreadid=548915



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Please help a newbie to VB!!!

val = InputBox("Enter a value")
Range("A1").Value = val


--
HTH

Bob Phillips

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

"certain_death"
wrote in message
news:certain_death.28zb11_1149594303.9491@excelfor um-nospam.com...

Hi all

Can anyone help me please?

I want to be able to run a macro in an excel spreadsheet that will
include a pop up msgbox that says "enter a value" and then a user can
put a value in and then i want it to put that value in Cell A1 (For
Example). This could be either a numeric number or a date field (eg
31/12/2006).
As I am a newbie to this I am struggling. The rest of the macro I have
done through recorder in excel, can anyone help me???

Many thanks for reading
Cheers and all the best
Mark
:) :)


--
certain_death
------------------------------------------------------------------------
certain_death's Profile:

http://www.excelforum.com/member.php...o&userid=24561
View this thread: http://www.excelforum.com/showthread...hreadid=548915





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Please help a newbie to VB!!!


Hey guys

That's brilliant thank you so much...

As a further help (please) can I make the value that is returned in
Cell A1 from the input box, copy down the same number of lines in
Column A as some corresponding data in Column B. For example, if I had
25 lines of data in column B can I get the value in A1 to copy down to
A25 and stop. (This could be a random amount of lines in Col B each
time)

Hope I make some sense here..........

Thanks a lot guys and great helpful forum...
Cheers
Mark
:) :) :)


--
certain_death
------------------------------------------------------------------------
certain_death's Profile: http://www.excelforum.com/member.php...o&userid=24561
View this thread: http://www.excelforum.com/showthread...hreadid=548915

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Please help a newbie to VB!!!


range([a1], cells([b1].end(xldown), 1)) = application.inputbox("Enter a
value")


C


--
colofnature
------------------------------------------------------------------------
colofnature's Profile: http://www.excelforum.com/member.php...o&userid=34356
View this thread: http://www.excelforum.com/showthread...hreadid=548915

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Please help a newbie to VB!!!


Hi Col

Am getting "Run Type Error 13" - "Type mismatch"

Am I doing anything wrong?

Thanks
Mark:)


--
certain_death
------------------------------------------------------------------------
certain_death's Profile: http://www.excelforum.com/member.php...o&userid=24561
View this thread: http://www.excelforum.com/showthread...hreadid=548915

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Please help a newbie to VB!!!


Without seeing more of your code I dunno... This happens when you're
comparing different types of data, e.g.:

if "a string" < 0 then

If you post up the macro causing the probs I'll have a look.


--
colofnature
------------------------------------------------------------------------
colofnature's Profile: http://www.excelforum.com/member.php...o&userid=34356
View this thread: http://www.excelforum.com/showthread...hreadid=548915

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Please help a newbie to VB!!!

Dim iLastRow As Long
Dim val

val = InputBox("Enter a value")
Range("A1").Value = val
iLastRow = Cells(Rows.Count, "B").End(xlUp).Row
Range("A1").AutoFill Range("A1").Resize(iLastRow)



--
HTH

Bob Phillips

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

"certain_death"
wrote in message
news:certain_death.28zehy_1149598804.5545@excelfor um-nospam.com...

Hey guys

That's brilliant thank you so much...

As a further help (please) can I make the value that is returned in
Cell A1 from the input box, copy down the same number of lines in
Column A as some corresponding data in Column B. For example, if I had
25 lines of data in column B can I get the value in A1 to copy down to
A25 and stop. (This could be a random amount of lines in Col B each
time)

Hope I make some sense here..........

Thanks a lot guys and great helpful forum...
Cheers
Mark
:) :) :)


--
certain_death
------------------------------------------------------------------------
certain_death's Profile:

http://www.excelforum.com/member.php...o&userid=24561
View this thread: http://www.excelforum.com/showthread...hreadid=548915





  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Please help a newbie to VB!!!


Hey guys,
That exactly what I need...thanks very much!!!

Am really interested in getting into this sort of thing....could you
recommend a good way of learning VB from scratch at beginner
level.....

This could help me so much in my job!!

Thanks again
Take it easy!!
Mark
:) :) :)


--
certain_death
------------------------------------------------------------------------
certain_death's Profile: http://www.excelforum.com/member.php...o&userid=24561
View this thread: http://www.excelforum.com/showthread...hreadid=548915

  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Please help a newbie to VB!!!

take a look at http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
HTH

Bob Phillips

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

"certain_death"
wrote in message
news:certain_death.290v9y_1149667202.1256@excelfor um-nospam.com...

Hey guys,
That exactly what I need...thanks very much!!!

Am really interested in getting into this sort of thing....could you
recommend a good way of learning VB from scratch at beginner
level.....

This could help me so much in my job!!

Thanks again
Take it easy!!
Mark
:) :) :)


--
certain_death
------------------------------------------------------------------------
certain_death's Profile:

http://www.excelforum.com/member.php...o&userid=24561
View this thread: http://www.excelforum.com/showthread...hreadid=548915



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
newbie ? Charles Eaves New Users to Excel 1 July 28th 08 09:11 AM
Real Newbie newbie question Dave New Users to Excel 0 January 10th 07 07:55 PM
Newbie Help. Is this possible? taltos1 Excel Discussion (Misc queries) 5 November 12th 05 04:40 PM
Newbie help Ed[_20_] Excel Programming 6 May 17th 04 09:43 PM
Newbie IF Jeff Excel Programming 8 May 16th 04 08:50 PM


All times are GMT +1. The time now is 07:53 PM.

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

About Us

"It's about Microsoft Excel"