![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 05:20 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com