ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   using macro to copy and paste filtered results, what if blank? (https://www.excelbanter.com/excel-worksheet-functions/122585-using-macro-copy-paste-filtered-results-what-if-blank.html)

priceyindevon

using macro to copy and paste filtered results, what if blank?
 
I have a sheet with 500 lines that are filtered for late deliveries, when
there are no late deliveries my macro can not paste to another sheet blank
results. How do I get round this problem?

Jim Thomlinson

using macro to copy and paste filtered results, what if blank?
 
Post your code so we can see what you are up to...
--
HTH...

Jim Thomlinson


"priceyindevon" wrote:

I have a sheet with 500 lines that are filtered for late deliveries, when
there are no late deliveries my macro can not paste to another sheet blank
results. How do I get round this problem?


priceyindevon

using macro to copy and paste filtered results, what if blank?
 
Hi,
The sheet is auto filtered for each day with the sub totals on line 502. But
if there are nil results (no lates) the macro below will not paste the nil
return. It states cannot change part of a merged cell!

Column B is the time
Column D is the name of delivery
Column G is the amount of product being delivered.

The results are then pasted to another worksheet to list late suppliers.

Sub sunlateam()
'
' sunlateam Macro
' Macro recorded 11/12/2006 by Mark Price
'

'
Sheets("Sun").Select
Application.Run "openall"
Application.Run "lateam"
Range("D11:D501").Select
Selection.Copy
Sheets("Suppliers").Select
Range("A6").Select
ActiveSheet.Paste
Application.CutCopyMode = False
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = True
.ReadingOrder = xlContext
.MergeCells = False
End With
Sheets("Sun").Select
Range("B11:B501").Select
Selection.Copy
Sheets("Suppliers").Select
Range("B6").Select
ActiveSheet.Paste
Sheets("Sun").Select
Range("G11:G501").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Suppliers").Select
Range("C6").Select
ActiveSheet.Paste
Range("A6:C55").Select
Application.CutCopyMode = False
Selection.FormatConditions.Delete
Selection.Interior.ColorIndex = xlNone
Selection.Font.ColorIndex = 0
Selection.Font.Bold = True
Selection.Font.Bold = False
Range("A6:A55").Select
ActiveCell.SpecialCells(xlCellTypeSameValidation). Select
With Selection.Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop,
Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = ""
.InputMessage = ""
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Range("A1").Select
End Sub

"Jim Thomlinson" wrote:

Post your code so we can see what you are up to...
--
HTH...

Jim Thomlinson


"priceyindevon" wrote:

I have a sheet with 500 lines that are filtered for late deliveries, when
there are no late deliveries my macro can not paste to another sheet blank
results. How do I get round this problem?



All times are GMT +1. The time now is 01:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com