Just to start over in describing my ordeal, I am having trouble with a macro that has as one of its tasks to copy a specified dynamic range and paste it in a different location in the workbook.
the problem though is that since sometimes there is no data in the dynamic range to be copied and in that scenario I need the macro to still continue to execute the rest of the tasks, so I added the following code:
Dim nm As Name
On Error Resume Next
Set nm = Workbooks("MyWorkbook").Names("DynamicHoldingTank")
If Not nm Is Nothing Then
'it exists!!
Sheets("DataBase").Select
Range("DynamicHoldingTank").Select
Selection.Copy
Application.Goto Reference:="R1048576C53"
Selection.End(xlUp).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(2, 10).Range("A1").Select
Else
'it doesn't!
End If
I also tried this different code:
With Sheets("Database").Range("DynamicHoldingTank")
If Not Application.WorksheetFunction.CountA(Range("DynamicHoldingTank")) = 0 Then
.Copy
End If
End With
to my dismay all the code included in the "IF" argument doesn't execute properly, the rest of the macro executes nicely, but the code inside the IF argument does not.
I hope I made myself clear and would greatly appreciate someone helping me.