Excel VBA programming question - TechRepublic
General discussion
October 25, 2005 at 12:49 PM
matthew.m.mason2

Excel VBA programming question

by matthew.m.mason2 . Updated 20 years, 8 months ago

I hope I’ve come to the right place on this, I’m a java guy and am not familiar with the VBA syntax. I’ve been asked by an attorney at my firm to write an excel spreadsheet that can email deadlines for filings once they fall below a 15 day limit. Sounds simple eh? Well I’ve got the majority of the code written with help from a great website. The problem is the code only polls for one cell and I need to make it poll for multiple cells, basically do a for loop or increase the cell range. Below is the code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range
If Target.Cells.Count > 1 Then Exit Sub
On Error GoTo EndMacro
If Not Target.HasFormula Then
Set rng = Target.Dependents
If Not Intersect(Range(“A1”), rng) Is Nothing Then
If Range(“A1”).Value < 16 Then Mail_with_outlook End If End If EndMacro: End Sub I've tried changing the cell range directly from A1 to A1:Z1 or "A1", "Z1" in the argument of the function. No go. Anybody have any ideas on how to make this thing poll for more than one row/cell? Your help is greatly appreciated.

This discussion is locked

All Comments