Results 1 to 25 of 25

How to create a msg before saving a excel Sheet

Threaded View

  1. #1
    Registered User
    Join Date
    01-17-2013
    Location
    banglore
    MS-Off Ver
    Excel 2010
    Posts
    18

    Post How to create a msg before saving a excel Sheet

    When I change this code ;I am getting some error..
    Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    Dim rowcount As Long
    Dim lstRow As Long
    Dim i As Long
    Sheet1.Activate
    lstRow = Range("A" & Rows.Count).End(xlUp).Row
    For i = 4 To lstRow
    If Range("A" & i).Value <> "" Then
    If Range("B" & i) = "" Or Range("C" & i) = "" Or Range("d" & i) = "" Or Range("E" & i) = "" Or Range("f" & i) = "" Or Range("G" & i) = "" Or Range("h" & i) = "" Or Range("i" & i) = "" Or Range("j" & i) = "" Or Range("k" & i) = "" Or Range("l" & i) = "" Or Range("m" & i) = "" Or Range("n" & i) = "" Or Range("o" & i) = "" Or Range("p" & i) = "" Or Range("q" & i) = "" Or Range("u" & i) = "" Or Range("v" & i) = "" Or Range("w" & i) = "" Or Range("x" & i) = "" Or Range("y" & i) = "" Or Range("z" & i) = "" Or Range("AA" & i) = "" Or Range("AB" & i) = "" Or Range("AC" & i) = "" Or Range("AD" & i) = "" Or Range("AE" & i) = "" Then
    MsgBox "you have to fill the Blank row", vbInformation, "MsgBox"
    
    Sheet1.Activate
    lstRow = Range("B" & Rows.Count).End(xlUp).Row
    If Range("B" & i).Value <> "" Then
    If Range("C" & i) = "" Or Range("d" & i) = "" Or Range("E" & i) = "" Or Range("f" & i) = "" Or Range("G" & i) = "" Or Range("h" & i) = "" Or Range("i" & i) = "" Or Range("j" & i) = "" Or Range("k" & i) = "" Or Range("l" & i) = "" Or Range("m" & i) = "" Or Range("n" & i) = "" Or Range("o" & i) = "" Or Range("p" & i) = "" Or Range("q" & i) = "" Or Range("u" & i) = "" Or Range("v" & i) = "" Or Range("w" & i) = "" Or Range("x" & i) = "" Or Range("y" & i) = "" Or Range("z" & i) = "" Or Range("AA" & i) = "" Or Range("AB" & i) = "" Or Range("AC" & i) = "" Or Range("AD" & i) = "" Or Range("AE" & i) = "" Then
    MsgBox "you have to fill the Blank row", vbInformation, "MsgBox"
    
    Cancel = (Len(Sheets("Sheet1").Range("J" & i).Value) = 0)
       If Cancel Then MsgBox "Please fill in Column J!"
      
    
    Cancel = True
    Exit Sub
    
    End If
    End If
    End If
    Next i
    End Sub
    Last edited by Swapnanjali; 01-21-2013 at 04:20 AM. Reason: I need some changes..vba code

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1