Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
vmc vmc is offline
external usenet poster
 
Posts: 1
Default Excel VBA help

I am needing some help with this vba code. What I am trying to do is first
verify if cell A4 is not empty, if it is not empty then I need it to make
sure there is data in the other columns before anyone can save. This is what
I got so far but it is saving and not bring the popup message that data is
missing.


Private Sub Workbook_BeforeSave(ByVal SaveAsUi As Boolean, Cancel As Boolean)

If IsEmpty(A4) = False Then 'make sure that A4 is not empty prior to running
the below if


If Worksheets("User's Sheet").Range("B4").Value = "" Then
msg = "Program Short Name must be filled in before saving."
Cancel = True
End If

'and

If Worksheets("User's Sheet").Range("F4").Value = "" Then
msg = "Gender must be filled in before saving."
Cancel = True
End If

'and

If Worksheets("User's Sheet").Range("G4").Value = "" Then
msg = "Color Name must be filled in before saving."
Cancel = True
End If

'and


If Worksheets("User's Sheet").Range("H4").Value = "" Then
msg = "Size must be filled in before saving."
Cancel = True
End If

'and

If Cancel Then
MsgBox msg
End If




End If
End Sub
 
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



All times are GMT +1. The time now is 11:58 PM.

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"