+ Reply to Thread
Results 1 to 2 of 2

VBA Code to allow changes for each cell in 12 rows.

  1. #1
    Registered User
    Join Date
    08-02-2012
    Location
    Mesa, AZ
    MS-Off Ver
    Excel 2010
    Posts
    22

    VBA Code to allow changes for each cell in 12 rows.

    Hi,

    I currently have the below code for an inventory tracking sheet to auto send me an email anytime the number for any given appliance reaches Zero.

    My problem is that I had to list each appliance on different tabs instead of it allowing me to just list on each row because the code only works per worksheet and not individual cells.

    It would be idea to keep it on one worksheet and just have the appliances listed on the 12 rows.

    Hope this makes sense.


    Dim xRg As Range
    'Update by Extendoffice 2018/3/7
    Private Sub Worksheet_Change(ByVal Target As Range)
    On Error Resume Next
    If Target.Cells.Count > 1 Then Exit Sub
    Set xRg = Intersect(Range("c6"), Target)
    If xRg Is Nothing Then Exit Sub
    If IsNumeric(Target.Value) And Target.Value < 1 Then
    Call Mail_small_Text_Outlook
    End If
    End Sub
    Sub Mail_small_Text_Outlook()
    Dim xOutApp As Object
    Dim xOutMail As Object
    Dim xMailBody As String
    Set xOutApp = CreateObject("Outlook.Application")
    Set xOutMail = xOutApp.CreateItem(0)
    xMailBody = "Hi there" & vbNewLine & vbNewLine & _
    "Attic stock alert for Range Hoods" & vbNewLine & _
    ""
    On Error Resume Next
    With xOutMail
    .To = "joneill@onni.com"
    .CC = ""
    .BCC = ""
    .Subject = "Range Hood Stock Alert"
    .Body = xMailBody
    .Send 'or use .Send
    End With
    On Error GoTo 0
    Set xOutMail = Nothing
    Set xOutApp = Nothing
    End Sub

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: VBA Code to allow changes for each cell in 12 rows.

    You probably just forgot to use CODE tags. Please edit your post and add them. See rule2 of: https://www.excelforum.com/forum-rul...rum-rules.html


    Let's assume* that there are 12 rows (consequtive) and in Column A is name of items and in column C (as it is used) is current count. Try such modification to your procedures:

    Please Login or Register  to view this content.
    *) no guessing would be needed if you'd post the attachment with sample file (see yellow box above your post)
    Best Regards,

    Kaper

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Code to copy rows to new sheet if cell contains
    By ~TaC~ in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-22-2019, 07:58 PM
  2. [SOLVED] Need help please with code to delete rows where a specified cell is blank
    By Grassman in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-12-2018, 10:03 AM
  3. [SOLVED] Hide rows based on cell value - VBA code
    By phbryan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-21-2015, 12:38 PM
  4. [SOLVED] Code to delete rows that contain any cell containing #N/A
    By darkfeld in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-04-2014, 03:50 PM
  5. [SOLVED] VBA code to highlight rows based on a cell
    By mugs62 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-11-2012, 07:08 AM
  6. Code not working - move rows when cell is less than zero
    By wishmaker in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-01-2011, 10:40 AM
  7. How to Add Rows From Active Cell with in a XLL Code
    By Sheraz in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-08-2006, 08:25 AM

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