Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
My code fails | Excel Programming | |||
Range.Value fails | Excel Programming | |||
Subtotal fails | Excel Programming | |||
Code fails if ran more than once | Excel Programming | |||
solver.xla fails | Excel Programming |