LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default Change_Event macro dismiss table1 copy reinstate Table1

I get an error on this line where I try to reinstate Table1 to the Summary sheet
row 3 on down to last row of data.


..ListObjects.Add(xlSrcRange, Range("$A$3:$D$" & tRow), , xlYes).Name = _
"Table1"

This line is used in another non-event code and works there. It is inside a With Sheets("Summary") statement in that code also.

Thanks,
Howard


Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

If Target.Count 1 Then Exit Sub
If Intersect(Target, Range("A:D")) Is Nothing Then Exit Sub
If LCase(ActiveSheet.Name) = "summary" Then GoTo done
If LCase(ActiveSheet.Name) = "begin blad" Then GoTo done

With Application
.EnableEvents = False
.ScreenUpdating = False
End With

Dim aRow As Long
Dim aRng As Range
Dim tRow As Long, i As Long

aRow = Target.Row

Set aRng = Range("A" & aRow).Resize(1, 4)

If Application.WorksheetFunction.CountA(aRng) = 4 Then

With Sheets("Summary")


For i = 1 To .ListObjects.Count
.ListObjects(i).Unlist
Next

aRng.Copy .Range("A" & Rows.Count).End(xlUp)(2)

'**** reinstate Table1 to Summary sheet *****
tRow = Cells(Rows.Count, "A").End(xlUp).Row
.ListObjects.Add(xlSrcRange, Range("$A$3:$D$" & tRow), , xlYes).Name = _
"Table1"
.ListObjects("Table1").TableStyle = "TableStyleLight2"


End With
End If


On Error GoTo aft_error

aft_error:

With Application
.EnableEvents = True
.ScreenUpdating = True
End With
done:
End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OnTime Change_Event macro AND copy to sheet2 macro trouble Howard Excel Programming 7 June 3rd 13 01:59 PM
Web Login, Table1 Vikram Dhemare Excel Programming 2 November 15th 09 02:46 AM
Cannot Dismiss the MsgBox Ron[_6_] Excel Programming 4 July 3rd 09 02:19 AM
reinstate smart tag Phippsy Excel Discussion (Misc queries) 0 May 18th 09 10:33 AM
Dismiss a dialog box (Via a Macro) msnews.microsoft.com[_9_] Excel Programming 3 October 28th 05 11:43 AM


All times are GMT +1. The time now is 04:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"