Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 337
Default Set name fails

When I try to run this code it fails to accept the "NameSave" It says <Method
"Range" of object'_Globle"failed

Private Sub CommandButton4_Click() 'Saves wookbook and exits


Dim NameSave As Range
Dim DateSave As Range

Sheets("Summary").Select

Set NameSave = Range("Summary!A2")
Set DateSave = Range("Summary!E213")

etc.

oldjasy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Set name fails

Hi
In VBA code you use
Set NameSave = Worksheets("Summary").Range("A2")
etc

yours is like worksheet function syntax.
regards
Paul

On May 10, 4:31 pm, Oldjay wrote:
When I try to run this code it fails to accept the "NameSave" It says <Method
"Range" of object'_Globle"failed

Private Sub CommandButton4_Click() 'Saves wookbook and exits

Dim NameSave As Range
Dim DateSave As Range

Sheets("Summary").Select

Set NameSave = Range("Summary!A2")
Set DateSave = Range("Summary!E213")

etc.

oldjasy



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 337
Default Set name fails

Thanks
One more question I wish to save this file using the date in DateSave.
The reference cell J213 is formated as 01-May-07 but DateSave formats as
5/1/07 which does save correctly because of th /'s\

Is there any way to change DateSave to the format in J213?

BankRecords = InputBox("Please enter file name to save", "Bank Records
Backup", "C:\Bank Records\" & NameSave & "" & DateSave)





" wrote:

Hi
In VBA code you use
Set NameSave = Worksheets("Summary").Range("A2")
etc

yours is like worksheet function syntax.
regards
Paul

On May 10, 4:31 pm, Oldjay wrote:
When I try to run this code it fails to accept the "NameSave" It says <Method
"Range" of object'_Globle"failed

Private Sub CommandButton4_Click() 'Saves wookbook and exits

Dim NameSave As Range
Dim DateSave As Range

Sheets("Summary").Select

Set NameSave = Range("Summary!A2")
Set DateSave = Range("Summary!E213")

etc.

oldjasy




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Set name fails

Hi
Try
DateSave = Format(DateValue(Range("J213").Text), "dd-mmm-yy")

regards
Paul

On May 10, 6:02 pm, Oldjay wrote:
Thanks
One more question I wish to save this file using the date in DateSave.
The reference cell J213 is formated as 01-May-07 but DateSave formats as
5/1/07 which does save correctly because of th /'s\

Is there any way to change DateSave to the format in J213?

BankRecords = InputBox("Please enter file name to save", "Bank Records
Backup", "C:\Bank Records\" & NameSave & "" & DateSave)



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
My code fails kirkm[_6_] Excel Programming 3 February 22nd 07 08:44 AM
Range.Value fails vga1976 Excel Programming 4 January 6th 07 12:48 AM
Subtotal fails Nicke[_18_] Excel Programming 6 September 27th 06 04:10 PM
Code fails if ran more than once Christy Excel Programming 11 August 31st 05 06:57 PM
solver.xla fails g.Lakshmi Excel Programming 1 August 23rd 04 11:57 AM


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