Hello,
I would like to find the code to set a start cell to check if there is a number in it, if not check next cell in the row?
Example sometimes the source data is in BL3 and others its BK3. so if I can set a short loop it might solve an issue.
Above snippet is from below here.
Regards,
Wayne
I would like to find the code to set a start cell to check if there is a number in it, if not check next cell in the row?
Example sometimes the source data is in BL3 and others its BK3. so if I can set a short loop it might solve an issue.
Code:
ws2.Range("A1").Value = ws1.Range("BL3").Value
Code:
Sub Import_SOR_Data1()
'
' Import_SOR_Data Macro
st = Timer
Set ws1 = Sheets("ServiceOrder")
Set ws2 = Sheets("Imported data")
ws2.Range("A1").Value = ws1.Range("BL3").Value
ws2.Range("A2").Value = ws1.Range("R16").Value
ws1.Select
lastrow = Cells(40, "A").End(xlDown).Row
Range("a40:a" & lastrow).Copy
ws2.Cells(3, "a").PasteSpecial
Range("p40:p" & lastrow).Copy
ws2.Cells(3, "b").PasteSpecial
Range("ac40:ac" & lastrow).Copy
ws2.Cells(3, "c").PasteSpecial
Range("al40:al" & lastrow).Copy
ws2.Cells(3, "d").PasteSpecial
Range("bk40:bk" & lastrow).Copy
ws2.Cells(3, "e").PasteSpecial
For i = 1 To 5
nr = Choose(i, 11, 11, 8, 55, 20)
ws2.Columns(i).ColumnWidth = nr
Next i
ws2.Range("A3").CurrentRegion.Rows.AutoFit
ws2.Select
Cells(1, 1).Select
Cells.Borders.LineStyle = xlLineStyleNone
Debug.Print Timer - st '0.18 sec
End Sub
Wayne