I'm still getting to grips with the Find Command. Basically, I have the below code that looks at a line in a sheet(ws_Site) based on the Line ID Number that is in column A and then Finds that that LineID_Value in a different sheet(ws_main) and copies a value from column I on that line across. Problem is, if the cell I is blank it copies it across and essentially clears the cell if there was data in it.
How can I adjust the below code to only set ws_main.Range(c.Address).Offset(0, 8).Value = LineID_Value if LineID_Value is not blank?
For Each LineID In ws_Site.Range("A7:A" & SiteRows) 'Loop through all the cells in range LineID_Value = LineID.Offset(0, 8).Value 'Dim c With ws_main Set c = .Range("A7:A3000").Find(LineID, LookIn:=xlValues) 'If Not c Is Nothing Then ws_main.Range(c.Address).Offset(0, 8).Value = LineID_Value 'End If End With Next LineID