Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default Message Box - With Text Input

Phil

You can use either VBA InputBox or Excel's The only difference is Excel's is
prefixed with the Application Object and they accept slightly different
parameters (Read up in VBA help)

Using Excel's

prompt=Application.InputBox("Enter a Reason","Reason Entry","Default
Reason")
Range("A1").Value=prompt

Be careful to check for cancelled inputboxes, etc as well though

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"PW11111" wrote in message
...
Hi,

I have a spreadsheet that I am moving information (rows) from one tab onto
another.

The spreadsheet logs projects - in either an arrivals or departures tab.

I have written a macro to move these projects when the user clicks a
button.
(See code below).

Application.ScreenUpdating = False

varAnswer = MsgBox("Send to Completed?", vbOKCancel, "Please Confirm")
If ((varAnswer = 1)) Then
ActiveCell.EntireRow.Select
Selection.Copy
Sheets("Completed").Select
Rows("12:12").Select
Selection.Insert Shift:=xlDown
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Departures").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Sheets("Completed").Select
Else
End If
End Sub


I would like to modify it so when the user clicks the button the
confirmation is asked - and then prompts the user for a reason. The user
can
then enter the reason in a text box - and this input can then be placed in
a
cell of my choosing.

If anyone knows a simple way to do it - and could help it would be great.

Thanks again

Phil


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Message Box - With Text Input

Thanks Nick - thats just what I need.
Phil

"Nick Hodge" wrote:

Phil

You can use either VBA InputBox or Excel's The only difference is Excel's is
prefixed with the Application Object and they accept slightly different
parameters (Read up in VBA help)

Using Excel's

prompt=Application.InputBox("Enter a Reason","Reason Entry","Default
Reason")
Range("A1").Value=prompt

Be careful to check for cancelled inputboxes, etc as well though

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"PW11111" wrote in message
...
Hi,

I have a spreadsheet that I am moving information (rows) from one tab onto
another.

The spreadsheet logs projects - in either an arrivals or departures tab.

I have written a macro to move these projects when the user clicks a
button.
(See code below).

Application.ScreenUpdating = False

varAnswer = MsgBox("Send to Completed?", vbOKCancel, "Please Confirm")
If ((varAnswer = 1)) Then
ActiveCell.EntireRow.Select
Selection.Copy
Sheets("Completed").Select
Rows("12:12").Select
Selection.Insert Shift:=xlDown
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Departures").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Sheets("Completed").Select
Else
End If
End Sub


I would like to modify it so when the user clicks the button the
confirmation is asked - and then prompts the user for a reason. The user
can
then enter the reason in a text box - and this input can then be placed in
a
cell of my choosing.

If anyone knows a simple way to do it - and could help it would be great.

Thanks again

Phil


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,173
Default Message Box - With Text Input

I would just re-format it in the code

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"PW11111" wrote in message
...

One last thing Nick - its all working fine - except that when the text is
entered into the cell I specify - it loses all the formatting / font /
colour
etc..!

is there anyway around this..? Or maybe to specify the font etc in the
code.

Thanks Again.

"Nick Hodge" wrote:

Phil

You can use either VBA InputBox or Excel's The only difference is Excel's
is
prefixed with the Application Object and they accept slightly different
parameters (Read up in VBA help)

Using Excel's

prompt=Application.InputBox("Enter a Reason","Reason Entry","Default
Reason")
Range("A1").Value=prompt

Be careful to check for cancelled inputboxes, etc as well though

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
www.nickhodge.co.uk


"PW11111" wrote in message
...
Hi,

I have a spreadsheet that I am moving information (rows) from one tab
onto
another.

The spreadsheet logs projects - in either an arrivals or departures
tab.

I have written a macro to move these projects when the user clicks a
button.
(See code below).

Application.ScreenUpdating = False

varAnswer = MsgBox("Send to Completed?", vbOKCancel, "Please Confirm")
If ((varAnswer = 1)) Then
ActiveCell.EntireRow.Select
Selection.Copy
Sheets("Completed").Select
Rows("12:12").Select
Selection.Insert Shift:=xlDown
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Departures").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Sheets("Completed").Select
Else
End If
End Sub


I would like to modify it so when the user clicks the button the
confirmation is asked - and then prompts the user for a reason. The
user
can
then enter the reason in a text box - and this input can then be placed
in
a
cell of my choosing.

If anyone knows a simple way to do it - and could help it would be
great.

Thanks again

Phil



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
Message or input thesaxonuk Excel Discussion (Misc queries) 4 October 25th 06 09:38 AM
Input Box and Message box Help Lost and Looking for Help Excel Programming 3 June 14th 06 06:13 PM
Validation input message box Fred Excel Programming 0 June 8th 05 11:29 PM
Can VBA accept input from a message box? dougmcc1[_7_] Excel Programming 1 October 7th 04 10:48 PM
input message tamersaid Excel Programming 1 June 6th 04 02:06 PM


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