Frank Kabel (Automate macro)

  • Thread starter Thread starter Douglas
  • Start date Start date
D

Douglas

Frank,

Disclaimer: VB is not one of my strengths. That said,VB
complained about the "Me.Range" statement -- any idea why?

Thanks again,

Doug
(Below is the code you provided)


Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("A1")) Is Nothing Then Exit
Sub
On Error GoTo CleanUp:
With Target
If .value then
Application.EnableEvents = False
' enter your code or call a different sub
end if
End With

CleanUp:
Application.EnableEvents = True
End Sub
 
Hi Douglas
you have to put this code in the worksheet module. Try the following
- open your workbook
- rightclick on the tab name and choose 'code'
- paste the code in the appearing VBA editor window (and put your
specific code into this macro or at least a messagebox to test if this
is working)
- close the editor
- save your workbook and enter something in cell A1
 
Douglas,

What exactly do you mean when you say that VB "complained" about
the Me object? Did you put the code in the worksheet's code
module, not a standard code module?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
Bravo!!

Yes, yesterday I put the code in a module but, thanks to
your help I dropped the code in the worksheet (with a
message box) and it worked as advertised.

Now all I've got to do is see if I can adapt this such
that it will fire off my macro on worksheet3 when the
user enters a value on worksheet1 (hopefully without the
user seeing it happen).

Thanks so much!

Doug
p.s. (off-topic) Ever heard of the conductor Lorin
Maazel? He was with the BRSO in Munich until last year.
 
Back
Top