dj44
09-04-2020, 10:49 AM
Good day folks,
I have a simple issue that I cant figure out.
I would like to insert some data into cells in another worksheet
In column A - I have listed the strings. In Column B the values to be inserted
In a separate worksheet I am looking for that string and then insert on the offset.
Sub Insert_into_Cells()
Dim oCell As Range
Dim i As Long
Dim ws As Worksheet
Dim ows As Worksheet
Set ws = ThisWorkbook.Worksheets("Data") ' Worksheet that contains the data
For i = 1 To ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
'------------------
For Each oCell In ThisWorkbook.Worksheets("Offset").Range("A1:A10").Cells
If InStr(1, oCell.Value, ws.Cells(i, "A").Value) > 0 Then
oCell.Offset(, 3).Value = ws.Cells(i, "B").Value
End If
Next oCell
Next i
End Sub
It looks ok but it refuses to insert the data.
If some one would be kind enough to have a look at my work book.
27069
Much appreciated
Thank you
I have a simple issue that I cant figure out.
I would like to insert some data into cells in another worksheet
In column A - I have listed the strings. In Column B the values to be inserted
In a separate worksheet I am looking for that string and then insert on the offset.
Sub Insert_into_Cells()
Dim oCell As Range
Dim i As Long
Dim ws As Worksheet
Dim ows As Worksheet
Set ws = ThisWorkbook.Worksheets("Data") ' Worksheet that contains the data
For i = 1 To ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
'------------------
For Each oCell In ThisWorkbook.Worksheets("Offset").Range("A1:A10").Cells
If InStr(1, oCell.Value, ws.Cells(i, "A").Value) > 0 Then
oCell.Offset(, 3).Value = ws.Cells(i, "B").Value
End If
Next oCell
Next i
End Sub
It looks ok but it refuses to insert the data.
If some one would be kind enough to have a look at my work book.
27069
Much appreciated
Thank you