pedie
Well-known Member
- Joined
- Apr 28, 2010
- Messages
- 3,875
I have the code below which works ok if name range if found but if name range is not found then it is giving error..
Please help.
Thanks
Pedie
Please help.
Thanks
Pedie
Code:
Sub test21()
Dim r As String
Sheets("Sheet1").Select
If Range(r) Is Nothing Then
MsgBox "Name missing..."
Exit Sub
Else
ThisWorkbook.Sheets("Data").Range("C2:C14").Copy
Range(r).Select
Do Until ActiveCell.Value = ""
ActiveCell.Offset(1, 0).Select
Loop
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=True
Application.CutCopyMode = False
MsgBox "Ok"
Application.ScreenUpdating = True
End If
End Sub