Results 1 to 3 of 3

Help for Beginner - Macro with IF Statements

Threaded View

RosieW Help for Beginner - Macro... 03-13-2017, 10:07 PM
:) Sixthsense :) Re: Help for Beginner - Macro... 03-14-2017, 12:10 AM
RosieW Re: Help for Beginner - Macro... 03-14-2017, 12:57 PM
  1. #1
    Registered User
    Join Date
    03-13-2017
    Location
    Virginia
    MS-Off Ver
    2013
    Posts
    34

    Red face Help for Beginner - Macro with IF Statements

    Hello,

    I would like some help in creating a macro. My spreadsheet has four cells in which numbers can be entered: B6, B8, B10, or B12. Not all of the cells require a number. I have created an Excel formula with multiple IF statements. The formula picks up the numbers entered in the cells and puts them in another cell, B27. The number in B27 will either be from one of the aforementioned cells or a combination of two of the cells. I would like to create a macro for a button so that when the user clicks on the button the numbers either appear in B27 or, if the number is too long (i.e., exceeds 30 characters) a message box will appear telling the user that the numbers entered need to be changed. The Excel formula I would like to convert to VBA is below. It has the limit of 7 IF statements that Excel allows, but I would like the macro to include the 8 IF statements below. If am very, very green to VBA programming and do not know where to begin with this and would appreciate any help anyone can give. Thank you.

    =IF(AND(B6>0,B8="",B10="",B12=""),B6,
    IF(AND(B6>0,B8>0,B10="",B12),B8,
    IF(b6>0,b8="",b10>0),b6&"/"&b10,
    IF(AND(B8>0,B10>0),B8&"/"&B10,
    IF(AND(B6="",B8="",B10="",B12>0),B12,
    IF(AND(OR(B8>0,B10>0,B12>0),B12>0),"Too many contract or numbers have been entered.  Please delete any extraneous numbers from cells B6, B8, B10, or B12."))))))
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. IF Statements (Beginner)
    By loganc123 in forum Excel - New Users/Basics
    Replies: 7
    Last Post: 02-03-2016, 12:42 AM
  2. Macro for a beginner
    By fac1987 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-24-2013, 02:14 PM
  3. Macro Beginner!!
    By R1ck in forum Excel General
    Replies: 4
    Last Post: 12-12-2011, 07:46 AM
  4. macro for beginner
    By sanlen in forum Excel General
    Replies: 2
    Last Post: 06-23-2010, 12:45 AM
  5. Beginner at macro needs help
    By embe in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2007, 07:16 AM
  6. [SOLVED] Macro for a beginner
    By Masha in forum Excel General
    Replies: 2
    Last Post: 02-14-2006, 02:45 AM
  7. macro beginner
    By Erica in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-29-2005, 12:05 PM

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