Save As VBA

  • Thread starter Thread starter Celicaevo
  • Start date Start date
C

Celicaevo

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top