Results 1 to 33 of 33

Coding Multiple Cases in VBA

Threaded View

  1. #1
    Registered User
    Join Date
    11-18-2005
    Posts
    17

    Coding Multiple Cases in VBA

    I am at a loss. I am writing VBA code to do the following:
    IF A1 > 50 then print array C1:E7

    I have this code and it works.

    Sub Test()
    If Range("A1") > 50 Then
    ActiveSheet.PageSetup.PrintArea = "C1:E7"
    ActiveWindow.SelectedSheets.PrintOut Copies:=1
    End If
    Call cler_print
    End Sub
    Sub cler_print()
    ActiveSheet.PageSetup.PrintArea = ""
    End Sub
    Now, I want to be able to do the same for the following within the same module:
    If A10>50 then print C10:E17
    If A21>50 then print C21:E30 and so on for three more 'tests' of variables

    Question: can a series of such commands be included in one code activated by one MACRO button? If so, how does one write a series of cases testing the values in a series of cells to deterine if an associated array should be printed?

    I have tried to do this repeatedly and cannot find the right syntax that will trigger a series of tests with one macro button click.

    In the end, I want to user to complete a checklist - then click a MACRO button that will print arrays of information if the values in specific cells meet the criterion >50. I want the code to 'test' the values in 6 different cells and to print, based on compliance with the criterion, 6 different arrays of information.

    I'm under the gun and am stalled. People are waiting on my solution and I can't seem to move forward as I am not too familiar with VBA.

    Can and will anyone HELP???

    Best regards...I know you are all busy!!


    Bill (e-mail address removed by mod)
    Last edited by billofsoo; 03-25-2009 at 09:25 AM. Reason: e-mail address removed by mod

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