P
Prabu
Hi All,
I'm getting the following error in my macro code:
Run Time error '1004':
Application-defined or object-defined error
My Code:
Dim r, nLastRow, ii, cc, nLastNewRow, nLTempA
Sheet4.Activate
With Sheet4
With .Range("A:Z")
Set r = ActiveSheet.UsedRange
nLastRow = r.Rows.count + r.Row - 1
For ii = 2 To nLastRow
LColBTestA = "A" & CStr(ii)
If .Range(LColBTestA).Cells.Interior.ColorIndex = xlNone Then
Sheet4.Range(LColBTestA).Cells.Select
Selection.Copy
Sheet5.Activate
If Len(Sheet5.Range("A2").Value) = 0 Then
Sheet5.Range("A2").Select
Application.ActiveSheet.Paste
Else
Set cc = ActiveSheet.UsedRange
nLastNewRow = cc.Rows.count + cc.Row - 1
nLTempA = "A" & CStr(nLastNewRow + 1)
Sheet5.Range(nLTempA).Select
Application.ActiveSheet.Paste
End If
End If
Next
End With
End With
Here i'm getting error on the following line:
Sheet4.Range(LColBTestA).Cells.Select
Plz help me to complete this code.....
Thanks,
JP
I'm getting the following error in my macro code:
Run Time error '1004':
Application-defined or object-defined error
My Code:
Dim r, nLastRow, ii, cc, nLastNewRow, nLTempA
Sheet4.Activate
With Sheet4
With .Range("A:Z")
Set r = ActiveSheet.UsedRange
nLastRow = r.Rows.count + r.Row - 1
For ii = 2 To nLastRow
LColBTestA = "A" & CStr(ii)
If .Range(LColBTestA).Cells.Interior.ColorIndex = xlNone Then
Sheet4.Range(LColBTestA).Cells.Select
Selection.Copy
Sheet5.Activate
If Len(Sheet5.Range("A2").Value) = 0 Then
Sheet5.Range("A2").Select
Application.ActiveSheet.Paste
Else
Set cc = ActiveSheet.UsedRange
nLastNewRow = cc.Rows.count + cc.Row - 1
nLTempA = "A" & CStr(nLastNewRow + 1)
Sheet5.Range(nLTempA).Select
Application.ActiveSheet.Paste
End If
End If
Next
End With
End With
Here i'm getting error on the following line:
Sheet4.Range(LColBTestA).Cells.Select
Plz help me to complete this code.....
Thanks,
JP