ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with Promting for wooksheet name in macro. (https://www.excelbanter.com/excel-programming/298255-help-promting-wooksheet-name-macro.html)

Leatherfoot[_2_]

Help with Promting for wooksheet name in macro.
 
I'm trying to get the macro to let me pick the name on the worksheet t
paste the info into. Here's what i have but it gives me an error
(run-time error '9' subscript out of range)

Help a newbie please! :)


Windows("CUP_Results.xls").Activate
Sheets("Pro Calc").Select
Range("A1:AF100").Select
Selection.Copy
Sheets(strWorksheet = InputBox("Please enter the name of th
worksheet")).Select
ActiveSheet.Past

--
Message posted from http://www.ExcelForum.com


Frank Kabel

Help with Promting for wooksheet name in macro.
 
Hi
not tested but try:
Dim target_name

Windows("CUP_Results.xls").Activate
target_name = InputBox("Please enter the name of theworksheet")
Sheets("Pro Calc").Range("A1:AF100").copy
Sheets(target_name).paste


--
Regards
Frank Kabel
Frankfurt, Germany


I'm trying to get the macro to let me pick the name on the worksheet
to paste the info into. Here's what i have but it gives me an error.
(run-time error '9' subscript out of range)

Help a newbie please! :)


Windows("CUP_Results.xls").Activate
Sheets("Pro Calc").Select
Range("A1:AF100").Select
Selection.Copy
Sheets(strWorksheet = InputBox("Please enter the name of the
worksheet")).Select
ActiveSheet.Paste


---
Message posted from http://www.ExcelForum.com/


Bob Phillips[_6_]

Help with Promting for wooksheet name in macro.
 
Change

Sheets(strWorksheet = InputBox("Please enter the name of the
worksheet")).Select

to

sSheet = InputBox("Please enter the name of the worksheet")
if sSheet < "" Then
Sheets(sSHeet).Select
End If


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Leatherfoot " wrote in message
...
I'm trying to get the macro to let me pick the name on the worksheet to
paste the info into. Here's what i have but it gives me an error.
(run-time error '9' subscript out of range)

Help a newbie please! :)


Windows("CUP_Results.xls").Activate
Sheets("Pro Calc").Select
Range("A1:AF100").Select
Selection.Copy
Sheets(strWorksheet = InputBox("Please enter the name of the
worksheet")).Select
ActiveSheet.Paste


---
Message posted from http://www.ExcelForum.com/




Leatherfoot[_3_]

Help with Promting for wooksheet name in macro.
 
Thanks so much guys... I copied your suggestion into the macro Bob and
it worked perfectly. :)


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 06:51 AM.

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