Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Exception Report

Hi
See Code below, Tom Ogilvy was kind enough to help me this
yesterday.

The Code should copy errors in sheet Emails to
Exception_Reports. I want the code to only copy cells in
columns a,b,c to Exception_Reports Sheet.

I tried adding the line
Set rng2 = rng1.Offset(0, -1).Resize(, 3)
But this is coming up with error Application or Object
Defined Error. Can anyone help me on this?

Also I tried using the
With Worksheets("Email")
So I dont have to select the sheet but this doesnt seem to
be working either. Can this macro not be run like this?

Thanks

Sub Exceptions_Report()
Dim rng As Range, rng1 As Range, rng2 As Range

With Worksheets("Email")
Set rng = Range(Cells(1, 1), Cells(1, 1).End(xlDown))
On Error Resume Next
Set rng1 = rng.Offset(0, 1).Resize(, 2).SpecialCells
(xlFormulas, xlErrors)
On Error GoTo 0
If Not rng1 Is Nothing Then
Set rng2 = rng1.Offset(0, -1).Resize(, 3)
rng2.Copy Destination:=Worksheets
("Exceptions_Report").Range("A8")
End If
End With

With Worksheets("Exceptions_Report")
Columns("A:A").HorizontalAlignment = xlLeft
End With

With Worksheets("Exceptions_Report").PageSetup
.PrintTitleRows = "$1:$7"
.LeftMargin = Application.InchesToPoints
(0.748031496062992)
.RightMargin = Application.InchesToPoints
(0.748031496062992)
.TopMargin = Application.InchesToPoints
(0.984251968503937)
.BottomMargin = Application.InchesToPoints
(0.984251968503937)
.HeaderMargin = Application.InchesToPoints
(0.511811023622047)
.FooterMargin = Application.InchesToPoints
(0.511811023622047)
.CenterHorizontally = True
.Orientation = xlLandscape
End With

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Exception Report

Looks like you are mixing and matching code, but perhaps:

Sub Exceptions_Report()
Dim rng As Range, rng1 As Range, rng2 As Range

With Worksheets("Email")
Set rng = .Range(.Cells(1, 1), .Cells(1, 1).End(xlDown))
On Error Resume Next
Set rng1 = rng.Offset(0, 1).Resize(, 2) _
.SpecialCells(xlFormulas, xlErrors)
On Error GoTo 0
If Not rng1 Is Nothing Then
set rng2 = Intersect(rng1.Entirerow, .Range("A:C"))
rng2.Copy Destination:=Worksheets( _
"Exceptions_Report").Range("A8")
End If
End With

With Worksheets("Exceptions_Report")
Columns("A:A").HorizontalAlignment = xlLeft
End With

With Worksheets("Exceptions_Report").PageSetup
.PrintTitleRows = "$1:$7"
.LeftMargin = Application.InchesToPoints
(0.748031496062992)
.RightMargin = Application.InchesToPoints
(0.748031496062992)
.TopMargin = Application.InchesToPoints
(0.984251968503937)
.BottomMargin = Application.InchesToPoints
(0.984251968503937)
.HeaderMargin = Application.InchesToPoints
(0.511811023622047)
.FooterMargin = Application.InchesToPoints
(0.511811023622047)
.CenterHorizontally = True
.Orientation = xlLandscape
End With

End Sub

--
Regards,
Tom Ogilvy

"Jahsonn" wrote in message
...
Hi
See Code below, Tom Ogilvy was kind enough to help me this
yesterday.

The Code should copy errors in sheet Emails to
Exception_Reports. I want the code to only copy cells in
columns a,b,c to Exception_Reports Sheet.

I tried adding the line
Set rng2 = rng1.Offset(0, -1).Resize(, 3)
But this is coming up with error Application or Object
Defined Error. Can anyone help me on this?

Also I tried using the
With Worksheets("Email")
So I dont have to select the sheet but this doesnt seem to
be working either. Can this macro not be run like this?

Thanks

Sub Exceptions_Report()
Dim rng As Range, rng1 As Range, rng2 As Range

With Worksheets("Email")
Set rng = Range(Cells(1, 1), Cells(1, 1).End(xlDown))
On Error Resume Next
Set rng1 = rng.Offset(0, 1).Resize(, 2).SpecialCells
(xlFormulas, xlErrors)
On Error GoTo 0
If Not rng1 Is Nothing Then
Set rng2 = rng1.Offset(0, -1).Resize(, 3)
rng2.Copy Destination:=Worksheets
("Exceptions_Report").Range("A8")
End If
End With

With Worksheets("Exceptions_Report")
Columns("A:A").HorizontalAlignment = xlLeft
End With

With Worksheets("Exceptions_Report").PageSetup
.PrintTitleRows = "$1:$7"
.LeftMargin = Application.InchesToPoints
(0.748031496062992)
.RightMargin = Application.InchesToPoints
(0.748031496062992)
.TopMargin = Application.InchesToPoints
(0.984251968503937)
.BottomMargin = Application.InchesToPoints
(0.984251968503937)
.HeaderMargin = Application.InchesToPoints
(0.511811023622047)
.FooterMargin = Application.InchesToPoints
(0.511811023622047)
.CenterHorizontally = True
.Orientation = xlLandscape
End With

End Sub



Reply
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
Creating an "exception" report from comparing 2 excel files Dedrie Excel Discussion (Misc queries) 0 January 26th 10 07:34 PM
Sum Based on Exception Cue Excel Discussion (Misc queries) 7 May 21st 08 12:31 AM
WHAT ARE THE CAUSES FOR 'EXCEPTION ERROR ' CAPTGNVR Excel Discussion (Misc queries) 0 January 29th 07 06:04 PM
Automate Excel report to place certain data into existing report? Craig Harrison Excel Worksheet Functions 3 July 25th 06 01:54 PM
Exception report in excel jj Excel Worksheet Functions 5 March 2nd 05 05:05 PM


All times are GMT +1. The time now is 04:17 AM.

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

About Us

"It's about Microsoft Excel"