VB for Excel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • billofsoo
    New Member
    • Mar 2009
    • 2

    VB for Excel

    I may be posting in the wrong area but probably someone here can help. I am writing VBA code to do the following:
    IF A1 > 50 then print array C1:E1

    I have this code and it works.

    Sub Test()
    If Range("A1") > 50 Then
    ActiveSheet.Pag eSetup.PrintAre a = "c1:e7"
    ActiveWindow.Se lectedSheets.Pr intOut Copies:=1
    End If
    Call cler_print
    End Sub
    Sub cler_print()
    ActiveSheet.Pag eSetup.PrintAre a = ""
    End Sub

    Now, I want to be able to do the same for the following:
    If A10>50 then print C10:E17
    If A21>50 then print C21:E30 and so on

    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 can be printed?

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

    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 (please respond to bmansfield@hscd sb.on.ca)
  • billofsoo
    New Member
    • Mar 2009
    • 2

    #2
    Sorry, I cross posted this question on the ExcelForm and Bytes: here are the links

    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

    Comment

    Working...