+ Reply to Thread
Results 1 to 3 of 3

Editing an existing macro for a spreadsheet

  1. #1
    Registered User
    Join Date
    07-10-2014
    Location
    Hertfordshire, England
    MS-Off Ver
    2003
    Posts
    2

    Question Editing an existing macro for a spreadsheet

    Hi,

    I know almost nothing about VBA, so am having great difficulties with this! I have an existing spreadsheet that has been set up so that you have to fill in data in 3 specific columns before you save the spreadsheet. I want to add a fourth mandatory field. The Visual Basic code I have in the current spreadsheet is as follows:-

    Please Login or Register  to view this content.
    I thought I could edit it by adding an extra "Or" command like so:-

    Please Login or Register  to view this content.
    However, doing that causes the spreadsheet to refuse to save at all, even if there is data in Column 27. I have entered data for the entire column but it still refuses to believe there's data there. What am I doing wrong? Any help gratefully received. I am using Excel 2003.

    Cheers!

    Lesley
    Last edited by Richard Buttrey; 07-10-2014 at 05:43 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Editing an existing macro for a spreadsheet

    Hi, and welcome to the forum. Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (Since this is your first post I'll change it on this occasion but please note for the futrure)

    Almost certainly you have a space or perhaps another non visible character in one of the cells.
    Personally for checking things like this I prefer to use formulae in the woorksheet and then check the value of the formula in the macro.

    So for instance I'd have a helper column that contained the formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Then a check cell which I'd name say "Check_Complete" which contains the formula
    Please Login or Register  to view this content.
    Then the macro code would be

    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    07-10-2014
    Location
    Hertfordshire, England
    MS-Off Ver
    2003
    Posts
    2

    Re: Editing an existing macro for a spreadsheet

    Sorry for the mistake with the code, thank you for fixing it. I like the simplicity of your code, but as this is a spreadsheet used by many, many people, I'm reluctant to add an helper column/check cell that could get overwritten or deleted by the curious and/or careless, but I'm certainly going to try it out to see if it works. Thank you!

    I have checked the column and re-checked the date column for blank cells, including deleting everything and starting from scratch but to no avail. Should my formula as it stands work?

    Thanks again.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How can i delete the non matching rows after compairing the 2 workbooks through Macro
    By Manish_Gupta in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-03-2013, 04:29 PM
  2. Editing Cell Formatting in an Existing (Damaged?) Macro
    By enturbulator in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-24-2012, 02:08 PM
  3. Editing existing macro help
    By ad9051 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-11-2011, 07:07 PM
  4. editing existing macro to add new column
    By dnmahendra in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-07-2010, 05:00 AM
  5. Editing existing Macro
    By jsheppard in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-11-2010, 12:11 AM

Tags for this Thread

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