Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-26-2020, 08:21 PM
Syed Shabbir Syed Shabbir is offline Declare wBk as workbook. Set wBk = workbooks("NewBook.xls") gives error: Subscript out of range. Windows 10 Declare wBk as workbook. Set wBk = workbooks("NewBook.xls") gives error: Subscript out of range. Office 2007
Novice
Declare wBk as workbook. Set wBk = workbooks("NewBook.xls") gives error: Subscript out of range.
 
Join Date: Sep 2020
Posts: 1
Syed Shabbir is on a distinguished road
Question Declare wBk as workbook. Set wBk = workbooks("NewBook.xls") gives error: Subscript out of range.

Sub main()



Dim i As Integer
Dim wrk As Workbook
Dim wsh As Worksheet, wrk_Name, wsh_Name, prmpt As String

prmpt = "Enter Workbook name:"

wrk_Name = Application.InputBox(prmpt)

prmpt = "Enter Worksheet name:"

wsh_Name = Application.InputBox(prmpt)


Set wrk = Workbooks(wrk_Name) 'This line gives error

'....
end sub
Reply With Quote
 

Tags
worked fine previously.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Runtime error '9': Subscript out of Range KingoftheKassel Excel Programming 1 06-13-2016 08:00 PM
Error: "Changes made were lost...reconnect with server", when switching "from" field randhurrle Outlook 2 02-25-2015 06:51 PM
Loop through folder of workbooks and copy range to other workbook Snvlsfoal Excel Programming 3 07-29-2011 05:55 AM
Declare wBk as workbook. Set wBk = workbooks("NewBook.xls") gives error: Subscript out of range. Subscript out of range error KHTAY Excel 6 03-28-2009 11:18 PM
Declare wBk as workbook. Set wBk = workbooks("NewBook.xls") gives error: Subscript out of range. Mysterious "Subscript out of range" error rnstewart Excel 4 12-29-2005 01:04 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:09 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft