ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do program a prompt in excel 97? (https://www.excelbanter.com/excel-programming/308950-re-how-do-program-prompt-excel-97-a.html)

Doug Glancy

How do program a prompt in excel 97?
 
Unday,

This will prompt the user where to paste. The user can type in a range, or
select it with the mouse:

Sub test()
Dim paste_range As Range

'"type := 8" means that it only accepts a range as input
Set paste_range = Application.InputBox(prompt:="Where to paste data?",
Type:=8)
Worksheets("Sheet1").Range("A1:A5").Copy _
Destination:=paste_range
End Sub

hth,

Doug Glancy

"Unday" wrote in message
...
In Lotus 1-2-3 I was able to program into a macro to promp for data(i.e. a
range to copy data to). I haven't been able to do that in excel 97. I

know
there must be a way. Can anyone help me?

Regards,

Unday




Tom Ogilvy

How do program a prompt in excel 97?
 
Doug give excellent advice. Just some added info. this will raise an error
if the user hits cancel, so

Sub test()
Dim paste_range As Range

'"type := 8" means that it only accepts a range as input
On Error Resume Next
Set paste_range = Application.InputBox( _
prompt:="Where to paste data?", Type:=8)
On Error Resume Next
if paste_range is nothing then
msgbox "You hit cancel"
Exit sub
end if
Worksheets("Sheet1").Range("A1:A5").Copy _
Destination:=paste_range
End Sub

--
Regards,
Tom Ogilvy

"Doug Glancy" wrote in message
...
Unday,

This will prompt the user where to paste. The user can type in a range,

or
select it with the mouse:

Sub test()
Dim paste_range As Range

'"type := 8" means that it only accepts a range as input
Set paste_range = Application.InputBox(prompt:="Where to paste data?",
Type:=8)
Worksheets("Sheet1").Range("A1:A5").Copy _
Destination:=paste_range
End Sub

hth,

Doug Glancy

"Unday" wrote in message
...
In Lotus 1-2-3 I was able to program into a macro to promp for data(i.e.

a
range to copy data to). I haven't been able to do that in excel 97. I

know
there must be a way. Can anyone help me?

Regards,

Unday







All times are GMT +1. The time now is 07:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com