Gopalakrishnan
Board Regular
- Joined
- Feb 19, 2013
- Messages
- 110
From my worksheet, I just wanted to copy completed cells from used range (** used columns) which would have more than 100 rows but minimum 5 or 10 cells only would contain values. Here I wanted to copy those completed values from activesheet and need to paste another book. Already I have designed code for pasting and other stuffs but got struck up with selecting completed cells. Below is code I designed to do that job and with this I'm getting subscript out of range error while running, please do the require! 
Code:
Sub DeleteEmptyRow1(File)
Dim i, j, k As Integer
Dim LR, LC As Integer
Workbooks(File).Activate
LC = ActiveSheet.UsedRange.Columns.Count
LR = ActiveSheet.UsedRange.Rows.Count
For i = LC To 1 Step -1
If ActiveSheet.Cells(1, i).Value = "DESIGNNOTE" Then
'If cri2 = 1 Then
For j = LR To 1 Step -1
If ActiveSheet.Cells(j, i).Value = "" Then
Else
k = i - 1
Range(Cells(j, k), Cells(j, i)).Select ' I'm getting error @ this line only
ThisWorkbook.Sheets("Sheet2").Activate
MsgBox "Entering into loop"
ActiveSheet.Range("A1").PasteSpecial
End If
Next
End If
Next
End Sub