Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default InputBox to name a range



In a worksheet named Title Generator I am trying to use a UserBox to name a
range then copy that range to a sheet named Sessions, per the code below.

This is producing appl. define or object defined error.

ActiveWorkbook.Names.Add Name:="SName", _
RefersTo:="=(Title Generator)$B$12:$T$503"

This is producing subscript out of range error.

ActiveWorkbook.Names.Add Name:="SName", _
RefersTo:="=Title Generator!$B$12:$T$503"

Option Explicit

Sub ToSessionSheet()
Dim SName As String
SName = InputBox("Enter a Session Name", "Session Name")
'MsgBox SName
If SName = vbNullString Then Exit Sub

ActiveWorkbook.Names.Add Name:="SName", _
RefersTo:="=(Title Generator)$B$12:$T$503"

Range(SName).Copy Sheets("Sessions").Range("B10000").End(xlUp).Offse t(1, 0)
SName = vbNullString

End Sub

Thanks.
Howard
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default InputBox to name a range

Hi Howard,

Am Mon, 25 Feb 2013 22:16:25 -0800 (PST) schrieb Howard:

ActiveWorkbook.Names.Add Name:="SName", _
RefersTo:="=(Title Generator)$B$12:$T$503"


try:
ActiveWorkbook.Names.Add Name:=SName, _
RefersTo:=Sheets("Title Generator").Range("$B$12:$T$503")


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default InputBox to name a range

On Monday, February 25, 2013 11:52:52 PM UTC-8, Claus Busch wrote:
Hi Howard,



Am Mon, 25 Feb 2013 22:16:25 -0800 (PST) schrieb Howard:



ActiveWorkbook.Names.Add Name:="SName", _


RefersTo:="=(Title Generator)$B$12:$T$503"




try:

ActiveWorkbook.Names.Add Name:=SName, _

RefersTo:=Sheets("Title Generator").Range("$B$12:$T$503")





Regards

Claus Busch

--

Win XP PRof SP2 / Vista Ultimate SP2

Office 2003 SP2 /2007 Ultimate SP2


Thanks Claus, I googled it and got close but could not make the final transition to work on my sheet and sheet names.

Appreciate it.

Regard,
Howard
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
Application.InputBox (Range) Rafi Excel Programming 2 February 10th 09 06:22 PM
Range through Inputbox jasmine Excel Programming 3 March 5th 07 12:13 AM
InputBox method with range Emily Edgington Excel Programming 6 September 8th 06 06:20 PM
Select range with InputBox. Is it possible? Isabel Excel Programming 3 March 16th 06 07:02 PM
Trying to return Range from InputBox Jiana Excel Programming 3 April 28th 04 11:25 PM


All times are GMT +1. The time now is 02:05 AM.

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"