#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Save As VBA


Ok Here is what i have so far:

Sub SaveAsCell()
Dim strName As String

On Error GoTo InvalidName
strName = Sheet1.Range("B26")
ActiveWorkbook.SaveAs strName

Exit Sub
InvalidName: MsgBox "No LS or G Enter " & strName & _
" Please Enter Number", vbCritical, ""
End Sub

Now I am not sure what to add. I want it to go to E26 on error of B26
(if its blank basically i want it to look in the other cell). I am lost
at what to do


--
Celicaevo
------------------------------------------------------------------------
Celicaevo's Profile: http://www.excelforum.com/member.php...o&userid=27740
View this thread: http://www.excelforum.com/showthread...hreadid=472478

  #2   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Save As VBA

One way:

Sub SaveAsCell()
Dim strName As String

With Sheet1
Select Case False
Case IsEmpty(.Range("B26"))
strName = .Range("B26")
Case IsEmpty(.Range("E26"))
strName = .Range("E26")
Case Else
MsgBox "No LS or G Enter " & strName & _
" Please Enter Number", vbCritical, ""
Exit Sub
End Select
End With

ActiveWorkbook.SaveAs strName

End Sub


"Celicaevo" wrote:


Ok Here is what i have so far:

Sub SaveAsCell()
Dim strName As String

On Error GoTo InvalidName
strName = Sheet1.Range("B26")
ActiveWorkbook.SaveAs strName

Exit Sub
InvalidName: MsgBox "No LS or G Enter " & strName & _
" Please Enter Number", vbCritical, ""
End Sub

Now I am not sure what to add. I want it to go to E26 on error of B26
(if its blank basically i want it to look in the other cell). I am lost
at what to do


--
Celicaevo
------------------------------------------------------------------------
Celicaevo's Profile: http://www.excelforum.com/member.php...o&userid=27740
View this thread: http://www.excelforum.com/showthread...hreadid=472478


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Save As VBA


Thanks works like a charm.
Didnt think of using the select option


--
Celicaevo
------------------------------------------------------------------------
Celicaevo's Profile: http://www.excelforum.com/member.php...o&userid=27740
View this thread: http://www.excelforum.com/showthread...hreadid=472478

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
Save, save as, page setup dimmed out in unprotected excel sheet? ccKeithJ Excel Discussion (Misc queries) 3 December 14th 07 07:07 PM
Command Button Save As Application.ExecuteExcel4Macro ("SAVE.AS?() Paul Dennis Excel Discussion (Misc queries) 5 September 18th 06 05:34 PM
how to get disk icon on save button of save as dialog like 2000 RichT Excel Discussion (Misc queries) 2 March 9th 06 08:13 PM
when i save xls file, debug script is running and canno't save fil Imtiaz Excel Discussion (Misc queries) 1 July 16th 05 03:47 PM
Save As - Multiple Sheets fails to save as text file Ravee Srinivasan Excel Programming 2 November 10th 03 04:05 PM


All times are GMT +1. The time now is 12:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"