Results 1 to 4 of 4

Thread: Run macro if cell has a specific value

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Newbie
    Joined
    Jun 2018
    Posts
    4
    Location

    Run macro if cell has a specific value

    Hi All,

    i'm creating a macro to print a specific range of offset cells. in my list there are 2 outcomes. if column H = X i would like to activate macro Retz() if column H is not X i would like to activate Macro ret(). i have a macro that should run Ret() & Retz() depending on the value of column N (select_cell()). i also have a macro that should activate (select_cell()) if i scan a barcode in Column A. now the problem is that I can't get (
    select_cell()) correct.
    Sorry i'm really new to VBA, i hope someone can help me!

    'this should print if select_cell() value is 3
    Sub ret() ' ' ret Macro ' ' ActiveCell.Offset(-1, 7).Range("A1:B1").Select Selection.PrintOut Copies:=1, Collate:=True ActiveCell.Offset(1, -7).Range("A1").Select End Sub 'this should print if select_cell() value is 2 Sub retz() ' ' retz Macro ' ' ActiveCell.Offset(-1, 10).Range("A1:B1").Select Selection.PrintOut Copies:=1, Collate:=True ActiveCell.Offset(1, -10).Range("A1").Select End Sub 'this should activate Select_cell() Private Sub worksheet_change(ByVal target As Range) If Not Application.Intersect(Range("a1:a1000"), Range(target.Address)) Is Nothing Then Call worksheet_change1 End If End Sub 'this should check the value of (-1) column N Sub select_cell() set = Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(-1, 13)).Select If Range.Value = "2" Then Call retz End If If Range.Value = "3" Then Call ret End If End Sub
    Last edited by dsvleeuw; 06-18-2018 at 10:54 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •