Ashok Kumar
04-14-2021, 09:59 AM
I am trying below code in Macros which transpose my data from one sheet to another sheet this working fine but if any of my cell goes empty it throw compile debug error , how can i handle empty cell in below macros
Error Run Time erro 1004
Application defined or object defined error
For x = 2 To LRow
Test1 = wsRaw.Cells(x, getColumn(wsRaw, "Col1")).Value
Test2 = wsRaw.Cells(x, getColumn(wsRaw, "Col2")).Value > Error in this column as it goes empty ?
For col = 1 To 45 Step 2
If wsRaw.Cells(x, col).Value <> "" Then
wsAR.Range("C" & sRow).Value = Test1
wsAR.Range("M" & sRow).Value = Test2
End If
Next col
sRow = sRow + 1
Next x
Error Run Time erro 1004
Application defined or object defined error
For x = 2 To LRow
Test1 = wsRaw.Cells(x, getColumn(wsRaw, "Col1")).Value
Test2 = wsRaw.Cells(x, getColumn(wsRaw, "Col2")).Value > Error in this column as it goes empty ?
For col = 1 To 45 Step 2
If wsRaw.Cells(x, col).Value <> "" Then
wsAR.Range("C" & sRow).Value = Test1
wsAR.Range("M" & sRow).Value = Test2
End If
Next col
sRow = sRow + 1
Next x