Results 1 to 4 of 4

VBA for Automation

Threaded View

  1. #1
    Registered User
    Join Date
    04-04-2007
    Posts
    4

    VBA for Automation

    Thread Locked. Code not wrapped


    I need help with the VBA I got. Below is my spreadsheet. I basically want Column B updated autmatically when I put numbers on Column C and D. Below that is the code that needs editing/adding. Right now, Column C is working but not for Column D. Please help. Thnx.

    (Spreadsheet):
    A1: Item Name B1: Current Balance C1: Daily Usage (-) D1: Restock (+)
    A2: Item Alpha B2:45 C2:______ D2:______
    A3: item Bravo B3: 120 C3:______ D3: ______

    (VBA):
    Private Sub Worksheet_Change(ByVal Target As Range)
    Const WS_RANGE As String = "C8:C24" '

    On Error GoTo ws_exit
    Application.EnableEvents = False

    If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
    With Target
    If IsNumeric(.Value) Then
    If IsNumeric(.Offset(0, -1).Value) Then
    .Offset(0, -1).Value = .Offset(0, -1).Value - .Value
    .Value = ""
    End If
    End If
    End With
    End If

    ws_exit:
    Application.EnableEvents = True
    End Sub

    I hope my request is clear enough. Thanks in advance for your replies.
    Last edited by VBA Noob; 04-05-2007 at 02:40 AM.

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