+ Reply to Thread
Results 1 to 25 of 25

How to create a msg before saving a excel Sheet

  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..
    Please Login or Register  to view this content.
    Last edited by Swapnanjali; 01-21-2013 at 04:20 AM. Reason: I need some changes..vba code

  2. #2
    Valued Forum Contributor
    Join Date
    09-04-2012
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    463

    Re: Excel VBA MAcro

    can you upload a sample file?
    then i can do it


    regard
    CA Mahaveer Somani

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Excel VBA MAcro

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.


  4. #4
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: Excel VBA MAcro

    Hi

    Try this code:

    Please Login or Register  to view this content.
    Click *, if my suggestion helps you. Have a good day!!

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

    Re: Excel VBA MAcro

    Thanks a lot for you help

    Can i add a macro if any row is blank it will also not let you save..

  6. #6
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: Excel VBA MAcro

    "if any row is blank " meaning which row? Please specify..

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

    Re: Excel VBA MAcro

    If any cell within the range

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

    Re: Excel VBA MAcro

    I have attached the file..
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor
    Join Date
    09-04-2012
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    463

    Re: Excel VBA MAcro

    but it is blank there is no data....?

    what is your exact need dear say clearly

  10. #10
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Excel VBA MAcro

    Swapnanjali,

    Please edit your thread title as per post 3. You need to edit the title in post 1.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  11. #11
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Excel VBA MAcro

    Your post does not comply with Rule 7 of our Forum RULES. Please do not ignore Moderators' or Administrators' requests - note that this includes requests by senior members as well, if you are unclear about their request or instruction then send a private message to them asking for help. Do not post a reply to a thread where a moderator has requested an action that has not been complied with e.g Title change or Code tags...etc

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

    Re: Excel VBA MAcro

    What i want is if someone will insert data In A4;he will have to put data throgh out the row; They can not leave any cell blank.That mans if column a has some data evey column has some data.. else they will not able to save blank.

  13. #13
    Valued Forum Contributor
    Join Date
    09-04-2012
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    463

    Re: Excel VBA MAcro

    do you mean if user put some data in column A4 then he have to put data up to column "AE4" otherwise file will not save, m i right dear
    i mean "AE" is your last restricted column ?

  14. #14
    Valued Forum Contributor
    Join Date
    09-04-2012
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    463

    Re: Excel VBA MAcro

    check this file swapnanjli ji


    If there is any problem then tell me

    Regards
    CA Mahaveer Somani
    Attached Files Attached Files

  15. #15
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Excel VBA MAcro

    Mahaveersomani,

    Your id will be banned, if you do not comply with forum rules.

  16. #16
    Valued Forum Contributor
    Join Date
    09-04-2012
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    463

    Re: Excel VBA MAcro

    actually i did not read his message therefore i did reply arlu ji......


    Regard
    CA Mahaveer Somani

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

    Re: Excel VBA MAcro

    Now plz tell me what to do

  18. #18
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Excel VBA MAcro

    You need to edit the thread title in post 1. Then assistance will pour in.

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

    Re: Excel VBA MAcro

    Hi Arlette,
    Kindly tell me one by one step. I am new to this forum ,Do nt know the rules and regulation ; I have now change the title; kindly say what to do next. I also need the solve of this thread..

  20. #20
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: How to create a msg before saving a excel Sheet

    Did you check solutions provided in this thread?

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

    Re: How to create a msg before saving a excel Sheet

    Yes , Zbor.

    It is a great helpful...

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

    Re: Excel VBA MAcro

    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

    Hi Mahaveer,

    I just made small changes in the above file.. I am getting Compling Error..

  23. #23
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: How to create a msg before saving a excel Sheet

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

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

    Re: How to create a msg before saving a excel Sheet

    I did the same..

  25. #25
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: How to create a msg before saving a excel Sheet

    Swapnanjali, nobody will answer you until you do what is asked.
    You could have your solution few days ago.

+ Reply to Thread

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