View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
David David is offline
external usenet poster
 
Posts: 1,560
Default Run Macro on Cell Change Error

GOT IT!! Simplier is better!
This is what works..
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1:A20")) Is Nothing Then
Call FillCells
End If
End Sub

I'm using this to automatically update an offset formula on sheet2 so when
new rows are entered or data changed in Column A (which is the offset data on
sheet two I want, it automatically updates everthing on sheet2 to match
sheet1.

"David" wrote:

I am getting a Type Mismatch error on this macro. The data in Column A is
text (names). When a name is changed, I want the macro to run. Help please.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1:A20")) Is Nothing Then
If Range("A1:A20") < "" Then 'The error occurs here'
Sheets(2).Select
Range("A1").Select
Selection.AutoFill Destination:=Range("A1:A20"),
Type:=xlFillDefault
Range("A1:A20").Select
Range("A1").Select
End If
End If
End Sub